Skip to content

Commit 22dc07a

Browse files
more windows specific fixes
1 parent f6a3aa5 commit 22dc07a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ jobs:
7272
activate-environment: true
7373
enable-cache: true
7474

75+
- name: Set Python path for Windows
76+
if: runner.os == 'Windows'
77+
run: |
78+
echo "PYO3_PYTHON=${{ env.pythonLocation }}\python.exe" >> $GITHUB_ENV
79+
7580
- name: Run tests
7681
shell: bash
7782
env:

crates/djls-server/src/queue.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,12 @@ mod tests {
281281
Ok(())
282282
});
283283

284-
match tokio::time::timeout(Duration::from_millis(500), submit_task).await {
284+
#[cfg(windows)]
285+
let timeout_ms = 1000;
286+
#[cfg(not(windows))]
287+
let timeout_ms = 500;
288+
289+
match tokio::time::timeout(Duration::from_millis(timeout_ms), submit_task).await {
285290
Ok(Ok(())) => {
286291
println!("Successfully submitted 33rd task");
287292
}
@@ -291,7 +296,11 @@ mod tests {
291296
),
292297
}
293298

299+
#[cfg(windows)]
300+
sleep(Duration::from_millis(500)).await;
301+
#[cfg(not(windows))]
294302
sleep(Duration::from_millis(200)).await;
303+
295304
assert_eq!(counter.load(Ordering::Relaxed), 33);
296305
}
297306

crates/djls-server/src/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ mod tests {
297297
assert!(session.get_document(&url).is_some());
298298

299299
// Should be queryable through database
300-
let path = PathBuf::from("/test.py");
300+
let path = paths::url_to_path(&url).unwrap_or_else(|| PathBuf::from("test.py"));
301301
let file = session.get_or_create_file(&path);
302302
let content = session.with_db(|db| source_text(db, file).to_string());
303303
assert_eq!(content, "print('hello')");
@@ -330,7 +330,7 @@ mod tests {
330330
assert_eq!(doc.version(), 2);
331331

332332
// Database should also see updated content
333-
let path = PathBuf::from("/test.py");
333+
let path = paths::url_to_path(&url).unwrap_or_else(|| PathBuf::from("test.py"));
334334
let file = session.get_or_create_file(&path);
335335
let content = session.with_db(|db| source_text(db, file).to_string());
336336
assert_eq!(content, "updated");

0 commit comments

Comments
 (0)