From 0db550c38ad9ba4ab4fb6fa8c070c040935e2f33 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 20 Mar 2024 06:20:54 -0400 Subject: [PATCH] Consolidated test support logic in jaraco.test.cpython. --- importlib_resources/tests/compat/py39.py | 30 ++++-------------------- setup.cfg | 2 +- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/importlib_resources/tests/compat/py39.py b/importlib_resources/tests/compat/py39.py index 81ec9aa..e158eb8 100644 --- a/importlib_resources/tests/compat/py39.py +++ b/importlib_resources/tests/compat/py39.py @@ -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') diff --git a/setup.cfg b/setup.cfg index feef590..e684c20 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,7 @@ testing = # local zipp >= 3.17 - jaraco.collections + jaraco.test >= 5.4 docs = # upstream