bpo-41718: libregrtest runtest avoids import_helper (GH-24983)

Inline import_helper.unload() in libregrtest.runtest to avoid one
import.
This commit is contained in:
Victor Stinner 2021-03-23 01:08:49 +01:00 committed by GitHub
parent 10417dd15f
commit 0473fb2229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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)