]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported ...
authorPablo Galindo <Pablogsal@gmail.com>
Thu, 8 Oct 2020 13:24:28 +0000 (14:24 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Oct 2020 13:24:28 +0000 (06:24 -0700)


Automerge-Triggered-By: @pablogsal
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 159a8387e4e97d408e537bd106c4192a41b4527b..fd12a7e7acbb46bee989cceef7b6c5361eaa26f3 100644 (file)
@@ -1,8 +1,9 @@
 import unittest
+from test.support.import_helper import import_fresh_module
 from test.support.warnings_helper import check_warnings
 
 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.