summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-23 00:08:49 (GMT)
committerGitHub <noreply@github.com>2021-03-23 00:08:49 (GMT)
commit0473fb222956063814b6beb5fd401f9eeaa8a56a (patch)
tree5493442ce9825c45f625b52787bb4df667df1f50
parent10417dd15f135c179cf4234d1abe506915d802ff (diff)
downloadcpython-0473fb222956063814b6beb5fd401f9eeaa8a56a.zip
cpython-0473fb222956063814b6beb5fd401f9eeaa8a56a.tar.gz
cpython-0473fb222956063814b6beb5fd401f9eeaa8a56a.tar.bz2
bpo-41718: libregrtest runtest avoids import_helper (GH-24983)
Inline import_helper.unload() in libregrtest.runtest to avoid one import.
-rw-r--r--Lib/test/libregrtest/runtest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py
index 470d7dd..927c470 100644
--- a/Lib/test/libregrtest/runtest.py
+++ b/Lib/test/libregrtest/runtest.py
@@ -11,7 +11,6 @@ import traceback
import unittest
from test import support
-from test.support import import_helper
from test.support import os_helper
from test.libregrtest.utils import clear_caches
from test.libregrtest.save_env import saved_test_environment
@@ -222,7 +221,10 @@ def _runtest_inner2(ns, test_name):
abstest = get_abs_module(ns, test_name)
# remove the module from sys.module to reload it if it was already imported
- import_helper.unload(abstest)
+ try:
+ del sys.modules[abstest]
+ except KeyError:
+ pass
the_module = importlib.import_module(abstest)