diff --git a/crates/djls-project/Cargo.toml b/crates/djls-project/Cargo.toml index 6cd1fd4..28d5864 100644 --- a/crates/djls-project/Cargo.toml +++ b/crates/djls-project/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -pyo3 = { workspace = true, features = ["auto-initialize"] } +pyo3 = { workspace = true } tower-lsp-server = { workspace = true, features = ["proposed"] } which = "7.0.1" diff --git a/crates/djls-project/src/lib.rs b/crates/djls-project/src/lib.rs index f9b407b..2d8233a 100644 --- a/crates/djls-project/src/lib.rs +++ b/crates/djls-project/src/lib.rs @@ -587,6 +587,8 @@ mod tests { let test_env = create_test_env(vec![path1.clone(), path2.clone()]); + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { let initial_sys_path = get_sys_path(py)?; let initial_len = initial_sys_path.len(); @@ -618,6 +620,8 @@ mod tests { fn test_activate_empty_sys_path() -> PyResult<()> { let test_env = create_test_env(vec![]); + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { let initial_sys_path = get_sys_path(py)?; @@ -642,6 +646,8 @@ mod tests { let test_env = create_test_env(vec![path1.clone(), path2.clone()]); + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { let initial_sys_path = get_sys_path(py)?; let initial_len = initial_sys_path.len(); @@ -689,6 +695,8 @@ mod tests { let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]); + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { let initial_sys_path = get_sys_path(py)?; let initial_len = initial_sys_path.len(); @@ -747,6 +755,8 @@ mod tests { let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]); + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| { let initial_sys_path = get_sys_path(py)?; let initial_len = initial_sys_path.len();