Remove a bit more python3.8/3.9 specific code

This commit is contained in:
Dave Halter
2026-04-27 00:42:07 +02:00
parent 1eddf24a50
commit a662298e2f
2 changed files with 6 additions and 22 deletions
+6 -20
View File
@@ -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()
-2
View File
@@ -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)