File tree Expand file tree Collapse file tree
importlib_resources/tests/compat Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from jaraco .collections import Projection
99
1010
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+
1120try :
1221 from test .support import import_helper # type: ignore
1322except 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+ )
1826
1927
2028try :
2129 from test .support import os_helper # type: ignore
2230except ImportError :
23-
24- class os_helper : # type:ignore
25- from test .support import temp_dir
31+ os_helper = from_test_support ('temp_dir' )
2632
2733
2834try :
You can’t perform that action at this time.
0 commit comments