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 terry.reedy
Recipients Lita.Cho, gpolo, jesstess, serhiy.storchaka, terry.reedy, zach.ware
Date 2014-08-22.01:54:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408672450.49.0.909451584619.issue21585@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2014-08-22 01:54:10terry.reedysetrecipients: + terry.reedy, gpolo, jesstess, zach.ware, serhiy.storchaka, Lita.Cho
2014-08-22 01:54:10terry.reedysetmessageid: <1408672450.49.0.909451584619.issue21585@psf.upfronthosting.co.za>
2014-08-22 01:54:10terry.reedylinkissue21585 messages
2014-08-22 01:54:09terry.reedycreate