Skip to content

Commit

Permalink
Add test capturing expectation that a Path is a Traversable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 3, 2024
1 parent 7d2b55b commit 2a7a5bc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test = [
"big-O",
"pytest-ignore-flaky",
"jaraco.test",
"importlib_resources; python_version < '3.9'",
]
doc = [
# upstream
Expand Down
14 changes: 14 additions & 0 deletions tests/compat/py39.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@
)

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


try:
from importlib.resources.abc import Traversable
except ImportError:
try:
# Python 3.9
from importlib.abc import Traversable
except ImportError:
# Python 3.8
from importlib_resources.abc import Traversable


__all__ = ['Traversable']
7 changes: 7 additions & 0 deletions tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,10 @@ def test_malformed_paths(self):
'two-slash.txt',
'parent.txt',
]

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

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

0 comments on commit 2a7a5bc

Please sign in to comment.