Message63313
Hi Brian;
The module is intended for test suites where the unit tests are written
to be independent of each other, which is the "standard" way to do
things. Note, for instance, that there is no convenient support for
changing the order in which tests run.
When tests are written like that, you can interrupt a bulk test run at
any point, and you can run a single test to reproduce and then debug a
failure.
Given your test suite, I can see how this '--one' option is helpful to
you, but I don't believe it should be made standard. (I've never seen
it in any XP-inspired test framework or related IDE UI.) However, you
can easily write a custom TestRunner that provides this "fast abort"
behaviour that you want, and then hook it into unittest as follows:
unittest.main(testRunner=MyCustomTestRunner())
(BTW, regarding the implementation, it's not ideal to pass the 'onlyOne'
parameter down and through to the run() method; much better would be to
initialise a TestResult subclass with the 'onlyOne' option, so that it
could then abort when 'addError' or 'addFailure' is called. You can use
that trick in any custom test runner you might write.)
Best wishes,
-Steve |
|
| Date |
User |
Action |
Args |
| 2008-03-06 08:27:28 | purcell | set | spambayes_score: 0.0104412 -> 0.010441221 recipients:
+ purcell, bcwhite |
| 2008-03-06 08:27:28 | purcell | set | spambayes_score: 0.0104412 -> 0.0104412 messageid: <1204792048.58.0.243202663791.issue2241@psf.upfronthosting.co.za> |
| 2008-03-06 08:27:27 | purcell | link | issue2241 messages |
| 2008-03-06 08:27:26 | purcell | create | |
|