Skip to content

Commit

Permalink
Move Python compatibility concerns to the appropriate modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 4, 2024
1 parent c24fc57 commit c6a3339
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
10 changes: 10 additions & 0 deletions tests/compat/py310.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys


if sys.version_info >= (3, 11):
from importlib.resources.abc import Traversable
else: # pragma: no cover
from .py38 import Traversable


__all__ = ['Traversable']
10 changes: 10 additions & 0 deletions tests/compat/py38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys


if sys.version_info >= (3, 9):
from importlib.abc import Traversable
else: # pragma: no cover
from importlib_resources.abc import Traversable


__all__ = ['Traversable']
14 changes: 0 additions & 14 deletions tests/compat/py39.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,3 @@
)

sys.modules[__name__ + '.os_helper'] = os_helper


try:
from importlib.resources.abc import Traversable
except ImportError: # pragma: no cover
try:
# Python 3.9
from importlib.abc import Traversable
except ImportError:
# Python 3.8
from importlib_resources.abc import Traversable # type: ignore[no-redef]


__all__ = ['Traversable']
2 changes: 1 addition & 1 deletion tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_malformed_paths(self):

@pass_alpharep
def test_interface(self, alpharep):
from .compat.py39 import Traversable
from .compat.py310 import Traversable

zf = zipfile.Path(alpharep)
assert isinstance(zf, Traversable)

0 comments on commit c6a3339

Please sign in to comment.