Skip to content

Commit

Permalink
Move test compatibility modules into a compat package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 6, 2024
1 parent 131906a commit aa1df53
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""
Backward-compatability shims to support Python 3.9 and earlier.
"""

import os


try:
from test.support import import_helper # type: ignore
except ImportError:
# Python 3.9 and earlier
class import_helper: # type: ignore
from test.support import (
modules_setup,
Expand All @@ -17,13 +20,11 @@ class import_helper: # type: ignore
try:
from test.support import os_helper # type: ignore
except ImportError:
# Python 3.9 compat
class os_helper: # type:ignore
from test.support import temp_dir


try:
# Python 3.10
from test.support.os_helper import unlink
except ImportError:
from test.support import unlink as _unlink
Expand Down
2 changes: 1 addition & 1 deletion importlib_resources/tests/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .. import abc
from ..abc import TraversableResources, ResourceReader
from . import util
from ._compat import os_helper
from .compat.py39 import os_helper


class SimpleLoader:
Expand Down
2 changes: 1 addition & 1 deletion importlib_resources/tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from . import data01
from . import util
from . import _path
from ._compat import os_helper, import_helper
from .compat.py39 import os_helper, import_helper


@contextlib.contextmanager
Expand Down
2 changes: 1 addition & 1 deletion importlib_resources/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from . import data01
from ..abc import ResourceReader
from ._compat import import_helper, os_helper
from .compat.py39 import import_helper, os_helper
from . import zip as zip_


Expand Down

0 comments on commit aa1df53

Please sign in to comment.