Skip to content

Commit

Permalink
Extract 'from_test_support' helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 6, 2024
1 parent 414e4c0 commit a8892ae
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions importlib_resources/tests/compat/py39.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@
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 test.support

names = 'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
import_helper = types.SimpleNamespace(**Projection(names, vars(test.support)))
import_helper = from_test_support(
'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
)


try:
from test.support import os_helper # type: ignore
except ImportError:

class os_helper: # type:ignore
from test.support import temp_dir
os_helper = from_test_support('temp_dir')


try:
Expand Down

0 comments on commit a8892ae

Please sign in to comment.