3 Commits

Author SHA1 Message Date
maxalbert
4ce52c8349 Merge c078c42a94 into 6aee460b1d 2025-01-14 11:53:10 +00:00
Maximilian Albert
c078c42a94 Rename test module to minimise risk of unexpected side-effects due to polluting sys.modules 2025-01-14 11:53:04 +00:00
Maximilian Albert
1ce0d00fb6 Modify test so that it actually reproduces the bug in #2044 2025-01-14 11:43:00 +00:00
2 changed files with 12 additions and 7 deletions

View File

@@ -593,13 +593,18 @@ def test_dict_completion(code, column, expected):
assert [c.complete for c in comps] == expected assert [c.complete for c in comps] == expected
def test_implicit_namespace_package_with_subpackages(): def test_implicit_namespace_package_with_subpackages(monkeypatch):
sys_path = [ sys_path_dir1 = get_example_dir('implicit_namespace_package_with_subpackages', 'ns1')
get_example_dir('implicit_namespace_package_with_subpackages', 'ns1'), sys_path_dir2 = get_example_dir('implicit_namespace_package_with_subpackages', 'ns2')
get_example_dir('implicit_namespace_package_with_subpackages', 'ns2'), monkeypatch.syspath_prepend(sys_path_dir1)
] monkeypatch.syspath_prepend(sys_path_dir2)
project = Project('.', sys_path=sys_path)
interpreter = jedi.Interpreter("import pkg; pkg.", namespaces=[], project=project) import pkg_implicit_namespace_package_test
interpreter = jedi.Interpreter(
"pkg_implicit_namespace_package_test.",
namespaces=[locals()],
project=Project('.')
)
comps = interpreter.complete() comps = interpreter.complete()
expected = ["pkgA", "pkgB"] expected = ["pkgA", "pkgB"]
assert [c.complete for c in comps] == expected assert [c.complete for c in comps] == expected