Skip to content

Commit

Permalink
Consolidated test support logic in jaraco.test.cpython.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 20, 2024
1 parent 74670d4 commit 0db550c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
30 changes: 5 additions & 25 deletions importlib_resources/tests/compat/py39.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,9 @@
Backward-compatability shims to support Python 3.9 and earlier.
"""

import types
from jaraco.test.cpython import from_test_support, try_import

from jaraco.collections import Projection


def from_test_support(*names):
"""
Return a SimpleNamespace of names from test.support.
"""
import test.support

return types.SimpleNamespace(**Projection(names, vars(test.support)))


try:
from test.support import import_helper # type: ignore
except ImportError:
import_helper = from_test_support(
'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
)


try:
from test.support import os_helper # type: ignore
except ImportError:
os_helper = from_test_support('temp_dir')
import_helper = try_import('import_helper') or from_test_support(
'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
)
os_helper = try_import('os_helper') or from_test_support('temp_dir')
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ testing =

# local
zipp >= 3.17
jaraco.collections
jaraco.test >= 5.4

docs =
# upstream
Expand Down

0 comments on commit 0db550c

Please sign in to comment.