Skip to content

Commit 0db550c

Browse files
committed
Consolidated test support logic in jaraco.test.cpython.
1 parent 74670d4 commit 0db550c

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

importlib_resources/tests/compat/py39.py

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,9 @@
22
Backward-compatability shims to support Python 3.9 and earlier.
33
"""
44

5-
import types
5+
from jaraco.test.cpython import from_test_support, try_import
66

7-
from jaraco.collections import Projection
8-
9-
10-
def from_test_support(*names):
11-
"""
12-
Return a SimpleNamespace of names from test.support.
13-
"""
14-
import test.support
15-
16-
return types.SimpleNamespace(**Projection(names, vars(test.support)))
17-
18-
19-
try:
20-
from test.support import import_helper # type: ignore
21-
except ImportError:
22-
import_helper = from_test_support(
23-
'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
24-
)
25-
26-
27-
try:
28-
from test.support import os_helper # type: ignore
29-
except ImportError:
30-
os_helper = from_test_support('temp_dir')
7+
import_helper = try_import('import_helper') or from_test_support(
8+
'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
9+
)
10+
os_helper = try_import('os_helper') or from_test_support('temp_dir')

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ testing =
3434

3535
# local
3636
zipp >= 3.17
37-
jaraco.collections
37+
jaraco.test >= 5.4
3838

3939
docs =
4040
# upstream

0 commit comments

Comments
 (0)