]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported...
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>
Fri, 9 Oct 2020 10:08:42 +0000 (15:38 +0530)
committerGitHub <noreply@github.com>
Fri, 9 Oct 2020 10:08:42 +0000 (11:08 +0100)
(cherry picked from commit 4a9f82f50d957b6cf3fd207de8b583d9137316b8)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Lib/test/test_lib2to3.py
Misc/NEWS.d/next/Tests/2020-10-08-14-00-17.bpo-41970.aZ8QFf.rst [new file with mode: 0644]

index 15c317e957bc05e612d09cb15fa5a3f6de739423..e939d47336e365739faa942061ead06a7eaa67a9 100644 (file)
@@ -1,8 +1,8 @@
 import unittest
-from test.support import check_warnings
+from test.support import check_warnings, import_fresh_module
 
 with check_warnings(("", PendingDeprecationWarning)):
-    from lib2to3.tests import load_tests
+    load_tests = import_fresh_module('lib2to3.tests', fresh=['lib2to3']).load_tests
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Misc/NEWS.d/next/Tests/2020-10-08-14-00-17.bpo-41970.aZ8QFf.rst b/Misc/NEWS.d/next/Tests/2020-10-08-14-00-17.bpo-41970.aZ8QFf.rst
new file mode 100644 (file)
index 0000000..4cdca19
--- /dev/null
@@ -0,0 +1,2 @@
+Avoid a test failure in ``test_lib2to3`` if the module has already imported
+at the time the test executes. Patch by Pablo Galindo.