From 8be54d3d470ed9062386965a096f3fd83d41d4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Fri, 5 May 2023 01:44:28 +0100 Subject: [PATCH] GH-103247: bypass the import cache on the _require_loader helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not a fix for the importlib test monkeypatching leakage but it's something that we probably should be doing anyway. Signed-off-by: Filipe LaĆ­ns --- Lib/test/test_import/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index 41dfdaabe24664..2f82dde79e2682 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -24,6 +24,7 @@ from unittest import mock import _testinternalcapi +from test.support import import_helper from test.support import os_helper from test.support import ( STDLIB_DIR, swap_attr, swap_item, cpython_only, is_emscripten, @@ -57,7 +58,7 @@ def _require_loader(module, loader, skip): if isinstance(module, str): - module = __import__(module) + module = import_helper.import_fresh_module(module) MODULE_KINDS = { BuiltinImporter: 'built-in',