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 michael.foord
Recipients michael.foord
Date 2009-09-21.10:54:19
SpamBayes Score 3.486075e-09
Marked as misclassified No
Message-id <1253530461.77.0.303608237398.issue6956@psf.upfronthosting.co.za>
In-reply-to
Content
Requested by Fernando Perez on the Testing in Python mailing list.

Test creation in TestProgram is done in both parseArgs and createTests.
It would be better if it was only done in createTests so that
controlling test creation only required the overloading of a single method.


> in TestProgram.parseArgs we have:
> 
>             if len(args) == 0 and self.defaultTest is None:
>                 self.test =
self.testLoader.loadTestsFromModule(self.module)
>                 return
> 
> and then later:
> 
>     def createTests(self):
>         self.test = self.testLoader.loadTestsFromNames(self.testNames,
>                                                        self.module)
> 
> So basically if you want to control how tests are created, you can't
just override createTests, because parseArgs also does test creation
> (but only sometimes, depending on certain conditions).

> I think that parseArgs should perhaps only parse args, and createTests
should only create tests, but I'm weird like that :)  For the case
> above, it could set a flag that createTests can then later use to
decide what to do, but parseArgs shouldn't be doing test creation IMO.
History
Date User Action Args
2009-09-21 10:54:21michael.foordsetrecipients: + michael.foord
2009-09-21 10:54:21michael.foordsetmessageid: <1253530461.77.0.303608237398.issue6956@psf.upfronthosting.co.za>
2009-09-21 10:54:20michael.foordlinkissue6956 messages
2009-09-21 10:54:20michael.foordcreate