This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients federico.granata, felixonmars, pablogsal, xtreak
Date 2020-10-08.12:55:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602161715.31.0.208207761021.issue41970@roundup.psfhosted.org>
In-reply-to
Content
I guess this could be due to loading the module twice where the warning is not emitted again on reimport which test__all__ seems to do so by importing lib2to3. One obvious fix would be to pass quiet=True. Else we need to find a way to import the module fresh like using import_fresh_module. Two possible patches. I assumed running tests sequentially will provide support for isolation too.

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)

# Using import fresh module

diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py
index 159a8387e4..861ae5ad53 100644
--- a/Lib/test/test_lib2to3.py
+++ b/Lib/test/test_lib2to3.py
@@ -1,7 +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)):
+    lib2to3 = import_fresh_module("lib2to3")
     from lib2to3.tests import load_tests
 
 if __name__ == '__main__':

# Passing quiet=True

diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py
index 159a8387e4..e4c5cade8b 100644
--- a/Lib/test/test_lib2to3.py
+++ b/Lib/test/test_lib2to3.py
@@ -1,7 +1,7 @@
 import unittest
 from test.support.warnings_helper import check_warnings
 
-with check_warnings(("", PendingDeprecationWarning)):
+with check_warnings(("", PendingDeprecationWarning), quiet=True):
     from lib2to3.tests import load_tests
 
 if __name__ == '__main__':

➜  cpython git:(master) ✗ ./python -m test test_lib2to3 test_lib2to3     
0:00:00 load avg: 0.01 Run tests sequentially
0:00:00 load avg: 0.01 [1/2] test_lib2to3
0:00:13 load avg: 0.23 [2/2] test_lib2to3

== Tests result: SUCCESS ==

All 2 tests OK.

Total duration: 27.3 sec
Tests result: SUCCESS
History
Date User Action Args
2020-10-08 12:55:15xtreaksetrecipients: + xtreak, felixonmars, pablogsal, federico.granata
2020-10-08 12:55:15xtreaksetmessageid: <1602161715.31.0.208207761021.issue41970@roundup.psfhosted.org>
2020-10-08 12:55:15xtreaklinkissue41970 messages
2020-10-08 12:55:14xtreakcreate