mirror of
https://github.com/davidhalter/jedi.git
synced 2026-04-27 12:31:26 +08:00
Remove a bit more python3.8/3.9 specific code
This commit is contained in:
+6
-20
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user