Skip to content

Commit 08f2340

Browse files
Add debug prints and a delay to venv path fallback test.
1 parent cad1267 commit 08f2340

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

crates/djls-project/src/lib.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,22 @@ mod tests {
331331

332332
// Provide an invalid explicit path (points to a non-existent directory)
333333
let invalid_path = project_dir.path().join("non_existent_venv");
334+
let invalid_path_str = invalid_path.to_str().unwrap();
334335
// Ensure the invalid path doesn't accidentally exist
335-
assert!(!invalid_path.exists(), "Invalid path should not exist");
336+
assert!(!invalid_path.exists(), "Invalid path '{}' should not exist before test", invalid_path.display());
336337

337-
let env = PythonEnvironment::new(project_dir.path(), Some(invalid_path.to_str().unwrap()))
338-
.expect("Should fall through to VIRTUAL_ENV");
338+
// --- Add a small delay before calling the function under test ---
339+
eprintln!("--- Adding small delay before PythonEnvironment::new call ---");
340+
std::thread::sleep(std::time::Duration::from_millis(50)); // 50ms delay
341+
eprintln!("--- Delay finished. Starting PythonEnvironment::new call for the test ---");
342+
// --- End added delay ---
343+
344+
eprintln!("--- Starting PythonEnvironment::new call for the test ---");
345+
// Call the function under test
346+
let env_result = PythonEnvironment::new(project_dir.path(), Some(invalid_path_str));
347+
eprintln!("--- Finished PythonEnvironment::new call for the test ---");
348+
349+
let env = env_result.expect("Should fall through to VIRTUAL_ENV");
339350

340351
// Should have found the one from VIRTUAL_ENV
341352
assert_eq!(

0 commit comments

Comments
 (0)