Terry J. Reedy added the comment:

The current test/test_*.py example file in the docs intentionally does not 
contain test_main.
https://docs.python.org/3/library/test.html#writing-unit-tests-for-the-test-package
The next section explaining that test.regrtest runs 
unittest.TestLoader.loadTestsFromModule if test_main does not exist. I believed 
support.run_unittest.

I never used test_main in test_idle.py, Grep test/test_*.py for 'test_main' or 
its absence to count others. Or search all issues for 'unittest discovery' for 
conversions.  For instance: #18258 made this change to the five 
test_codecmaps*.py files.
http://bugs.python.org/file30644/test_codecmaps_discovery.diff
-def test_main():
-    support.run_unittest(__name__)
-
 if __name__ == "__main__":
-    test_main()
+    support.use_resources = ['urlfetch']
+    unittest.main()

This all said, running all tests in a file with two different values of an 
attribute of the tested module is an exceptional case.  Zach, what do you think?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21585>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to