Message92929
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. |
|
Date |
User |
Action |
Args |
2009-09-21 10:54:21 | michael.foord | set | recipients:
+ michael.foord |
2009-09-21 10:54:21 | michael.foord | set | messageid: <1253530461.77.0.303608237398.issue6956@psf.upfronthosting.co.za> |
2009-09-21 10:54:20 | michael.foord | link | issue6956 messages |
2009-09-21 10:54:20 | michael.foord | create | |
|