Skip to content

Commit 8eb2071

Browse files
committed
Move test compatibility modules into a compat package.
1 parent 131906a commit 8eb2071

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

importlib_resources/tests/compat/__init__.py

Whitespace-only changes.

importlib_resources/tests/_compat.py renamed to importlib_resources/tests/compat/py39.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
"""
2+
Backward-compatability shims to support Python 3.9 and earlier.
3+
"""
4+
15
import os
26

37

48
try:
59
from test.support import import_helper # type: ignore
610
except ImportError:
7-
# Python 3.9 and earlier
11+
812
class import_helper: # type: ignore
913
from test.support import (
1014
modules_setup,
@@ -17,13 +21,12 @@ class import_helper: # type: ignore
1721
try:
1822
from test.support import os_helper # type: ignore
1923
except ImportError:
20-
# Python 3.9 compat
24+
2125
class os_helper: # type:ignore
2226
from test.support import temp_dir
2327

2428

2529
try:
26-
# Python 3.10
2730
from test.support.os_helper import unlink
2831
except ImportError:
2932
from test.support import unlink as _unlink

importlib_resources/tests/test_custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .. import abc
77
from ..abc import TraversableResources, ResourceReader
88
from . import util
9-
from ._compat import os_helper
9+
from .compat.py39 import os_helper
1010

1111

1212
class SimpleLoader:

importlib_resources/tests/test_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from . import data01
1010
from . import util
1111
from . import _path
12-
from ._compat import os_helper, import_helper
12+
from .compat.py39 import os_helper, import_helper
1313

1414

1515
@contextlib.contextmanager

importlib_resources/tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from . import data01
1010
from ..abc import ResourceReader
11-
from ._compat import import_helper, os_helper
11+
from .compat.py39 import import_helper, os_helper
1212
from . import zip as zip_
1313

1414

0 commit comments

Comments
 (0)