Skip to content

Commit 8d1f06c

Browse files
pablogsaltirkarthi
authored andcommitted
[3.9] bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported (pythonGH-22595)
… Automerge-Triggered-By: @pablogsal. (cherry picked from commit 4a9f82f) Co-authored-by: Pablo Galindo <[email protected]>
1 parent 3da210b commit 8d1f06c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Lib/test/test_lib2to3.py

Lines changed: 2 additions & 2 deletions
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()
Lines changed: 2 additions & 0 deletions
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)