From aa302c58dbe047609179f61c65d531a1ecf036fb Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Tue, 14 Jan 2025 11:53:04 +0000 Subject: [PATCH] Rename test module to minimise risk of unexpected side-effects due to polluting sys.modules --- .../pkgA/__init__.py | 0 .../pkgB/__init__.py | 0 test/test_api/test_interpreter.py | 8 ++++++-- 3 files changed, 6 insertions(+), 2 deletions(-) rename test/examples/implicit_namespace_package_with_subpackages/ns1/{pkg => pkg_implicit_namespace_package_test}/pkgA/__init__.py (100%) rename test/examples/implicit_namespace_package_with_subpackages/ns2/{pkg => pkg_implicit_namespace_package_test}/pkgB/__init__.py (100%) diff --git a/test/examples/implicit_namespace_package_with_subpackages/ns1/pkg/pkgA/__init__.py b/test/examples/implicit_namespace_package_with_subpackages/ns1/pkg_implicit_namespace_package_test/pkgA/__init__.py similarity index 100% rename from test/examples/implicit_namespace_package_with_subpackages/ns1/pkg/pkgA/__init__.py rename to test/examples/implicit_namespace_package_with_subpackages/ns1/pkg_implicit_namespace_package_test/pkgA/__init__.py diff --git a/test/examples/implicit_namespace_package_with_subpackages/ns2/pkg/pkgB/__init__.py b/test/examples/implicit_namespace_package_with_subpackages/ns2/pkg_implicit_namespace_package_test/pkgB/__init__.py similarity index 100% rename from test/examples/implicit_namespace_package_with_subpackages/ns2/pkg/pkgB/__init__.py rename to test/examples/implicit_namespace_package_with_subpackages/ns2/pkg_implicit_namespace_package_test/pkgB/__init__.py diff --git a/test/test_api/test_interpreter.py b/test/test_api/test_interpreter.py index c3d18f77..8102d337 100644 --- a/test/test_api/test_interpreter.py +++ b/test/test_api/test_interpreter.py @@ -599,8 +599,12 @@ def test_implicit_namespace_package_with_subpackages(monkeypatch): monkeypatch.syspath_prepend(sys_path_dir1) monkeypatch.syspath_prepend(sys_path_dir2) - import pkg - interpreter = jedi.Interpreter("pkg.", namespaces=[locals()], project=Project('.')) + import pkg_implicit_namespace_package_test + interpreter = jedi.Interpreter( + "pkg_implicit_namespace_package_test.", + namespaces=[locals()], + project=Project('.') + ) comps = interpreter.complete() expected = ["pkgA", "pkgB"] assert [c.complete for c in comps] == expected