[Python-Dev] [Python-checkins] cpython: #14533: if a test has no test_main, use loadTestsFromModule. (original) (raw)
R. David Murray rdmurray at bitdance.com
Mon Apr 9 21:57:37 CEST 2012
- Previous message: [Python-Dev] [Python-checkins] cpython: #14533: if a test has no test_main, use loadTestsFromModule.
- Next message: [Python-Dev] [Python-checkins] cpython: #14533: if a test has no test_main, use loadTestsFromModule.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 09 Apr 2012 13:34:25 -0400, Terry Reedy <tjreedy at udel.edu> wrote:
On 4/9/2012 9:13 AM, r.david.murray wrote: > http://hg.python.org/cpython/rev/eff551437abd > changeset: 76176:eff551437abd > user: R David Murray<rdmurray at bitdance.com> > date: Mon Apr 09 08:55:42 2012 -0400 > summary: > #14533: if a test has no testmain, use loadTestsFromModule. > > This moves us further in the direction of using normal unittest facilities > instead of specialized regrtest ones. Any test module that can be correctly > run currently using 'python unittest -m test.testxxx' can now be converted to > use normal unittest test loading by simply deleting its testmain, thus no > longer requiring manual maintenance of the list of tests to run. ... > + if name == 'main': > + unittest.main() > > - if name == 'main': > - testmain() Being on Windows, I sometimes run single tests interactively with from test import testxxx as t; t.testmain() Should t.unittest.main(t.name) work as well?
That will work.
t.unittest.main(t) will also work and is less typing.
Should this always work even if there is still a testmain?
It will work if and only if the test can be run correctly via './python -m unittest test.test_xxx'. Not all test files in Lib/test can be run that way (though I at least am open to fixing ones that don't work).
--David
- Previous message: [Python-Dev] [Python-checkins] cpython: #14533: if a test has no test_main, use loadTestsFromModule.
- Next message: [Python-Dev] [Python-checkins] cpython: #14533: if a test has no test_main, use loadTestsFromModule.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]