Skip to content

Commit c6f41e6

Browse files
tirkarthipablogsal
andauthored
[3.9] bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported (GH-22595) (GH-22609)
(cherry picked from commit 4a9f82f) Co-authored-by: Pablo Galindo <[email protected]>
1 parent 3da210b commit c6f41e6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/test/test_lib2to3.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import unittest
2-
from test.support import check_warnings
2+
from test.support import check_warnings, import_fresh_module
33

44
with check_warnings(("", PendingDeprecationWarning)):
5-
from lib2to3.tests import load_tests
5+
load_tests = import_fresh_module('lib2to3.tests', fresh=['lib2to3']).load_tests
66

77
if __name__ == '__main__':
88
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Avoid a test failure in ``test_lib2to3`` if the module has already imported
2+
at the time the test executes. Patch by Pablo Galindo.

0 commit comments

Comments
 (0)