From a662298e2f7d1914d066a7017ca96ae7091b1ecc Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 27 Apr 2026 00:42:07 +0200 Subject: [PATCH] Remove a bit more python3.8/3.9 specific code --- jedi/plugins/pytest.py | 26 ++++++-------------------- test/test_api/test_refactoring.py | 2 -- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/jedi/plugins/pytest.py b/jedi/plugins/pytest.py index 93e48058..ae27da4e 100644 --- a/jedi/plugins/pytest.py +++ b/jedi/plugins/pytest.py @@ -138,28 +138,14 @@ def _find_pytest_plugin_modules() -> List[List[str]]: See https://docs.pytest.org/en/stable/how-to/writing_plugins.html#setuptools-entry-points """ - if sys.version_info >= (3, 8): - from importlib.metadata import entry_points - - if sys.version_info >= (3, 10): - pytest_entry_points = entry_points(group="pytest11") - else: - pytest_entry_points = entry_points().get("pytest11", ()) - - if sys.version_info >= (3, 9): - return [ep.module.split(".") for ep in pytest_entry_points] - else: - # Python 3.8 doesn't have `EntryPoint.module`. Implement equivalent - # to what Python 3.9 does (with additional None check to placate `mypy`) - matches = [ - ep.pattern.match(ep.value) - for ep in pytest_entry_points - ] - return [x.group('module').split(".") for x in matches if x] + from importlib.metadata import entry_points + if sys.version_info >= (3, 10): + pytest_entry_points = entry_points(group="pytest11") else: - from pkg_resources import iter_entry_points - return [ep.module_name.split(".") for ep in iter_entry_points(group="pytest11")] + pytest_entry_points = entry_points().get("pytest11", ()) + + return [ep.module.split(".") for ep in pytest_entry_points] @inference_state_method_cache() diff --git a/test/test_api/test_refactoring.py b/test/test_api/test_refactoring.py index ae7b5b31..afbacb2b 100644 --- a/test/test_api/test_refactoring.py +++ b/test/test_api/test_refactoring.py @@ -54,8 +54,6 @@ def test_rename_mod(Script, dir_with_content): ''').format(dir=dir_with_content) -# TODO does this test still make sense? -@pytest.mark.skipif('sys.version_info[:2] < (3, 8)', reason="Python 3.8 introduces dirs_exist_ok") def test_namespace_package(Script, tmpdir): origin = get_example_dir('implicit_namespace_package') shutil.copytree(origin, tmpdir.strpath, dirs_exist_ok=True)