File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
importlib_resources/tests/compat Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 8
8
from jaraco .collections import Projection
9
9
10
10
11
+ def from_test_support (* names ):
12
+ """
13
+ Return a SimpleNamespace of names from test.support.
14
+ """
15
+ import test .support
16
+
17
+ return types .SimpleNamespace (** Projection (names , vars (test .support )))
18
+
19
+
11
20
try :
12
21
from test .support import import_helper # type: ignore
13
22
except ImportError :
14
- import test .support
15
-
16
- names = 'modules_setup' , 'modules_cleanup' , 'DirsOnSysPath'
17
- import_helper = types .SimpleNamespace (** Projection (names , vars (test .support )))
23
+ import_helper = from_test_support (
24
+ 'modules_setup' , 'modules_cleanup' , 'DirsOnSysPath'
25
+ )
18
26
19
27
20
28
try :
21
29
from test .support import os_helper # type: ignore
22
30
except ImportError :
23
-
24
- class os_helper : # type:ignore
25
- from test .support import temp_dir
31
+ os_helper = from_test_support ('temp_dir' )
26
32
27
33
28
34
try :
You can’t perform that action at this time.
0 commit comments