Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0473fb2

Browse files
authored
bpo-41718: libregrtest runtest avoids import_helper (GH-24983)
Inline import_helper.unload() in libregrtest.runtest to avoid one import.
1 parent 10417dd commit 0473fb2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/test/libregrtest/runtest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import unittest
1212

1313
from test import support
14-
from test.support import import_helper
1514
from test.support import os_helper
1615
from test.libregrtest.utils import clear_caches
1716
from test.libregrtest.save_env import saved_test_environment
@@ -222,7 +221,10 @@ def _runtest_inner2(ns, test_name):
222221
abstest = get_abs_module(ns, test_name)
223222

224223
# remove the module from sys.module to reload it if it was already imported
225-
import_helper.unload(abstest)
224+
try:
225+
del sys.modules[abstest]
226+
except KeyError:
227+
pass
226228

227229
the_module = importlib.import_module(abstest)
228230

0 commit comments

Comments
 (0)