Issue1550272
Created on 2006-09-01 02:44 by collinwinter, last changed 2007-03-07 09:11 by georg.brandl.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
test_unittest.py
|
collinwinter,
2007-01-30 06:30
|
Test suite for unittest |
|
|
|
msg51037 - (view) |
Author: Collin Winter (collinwinter) |
Date: 2006-09-01 02:44 |
|
This file replaces the current version
Lib/test/test_unittest.py, which only contains a single
test. The attached suite contains 128 tests for the
mission-critical parts of unittest.
A patch will follow shortly that fixes the bugs in
unittest uncovered by this test suite.
|
|
msg51038 - (view) |
Author: Collin Winter (collinwinter) |
Date: 2006-09-01 02:52 |
|
Logged In: YES
user_id=1344176
That promised patch for unittest is #1550273.
|
|
msg51039 - (view) |
Author: John J Lee (jjlee) |
Date: 2007-01-30 02:15 |
|
Oh the irony. :)
This is good stuff. I have not reviewed the whole patch, but sampling bits of it it looks fine. No great danger in committing this, so why not let's commit it?
Of the following points, I think only the first should block commit of this patch. Any comments on that first point?
1. test_loadTestsFromName__module_not_loaded() and test_loadTestsFromNames__module_not_loaded() -- these may break in future, and may break e.g. only when running tests in random order, which is sometimes done when debugging obscure stuff. Better to introduce a module of your own in Lib/test that's guaranteed not to be loaded already -- maybe test_unittest_fodder.py . Still, that wouldn't help the case where somebody is running the tests in a loop, which would cause failures already (again, this is something people do as part of bug detection / removal). I don't know the import internals and I hear they're messy, but perhaps just del sys.modules[module_name] at the start of each of those two methods is at least an improvement over what they do now.
2. Would be helpful to list what remains to be tested (for example, there is no test of assertRaises)
3. Why no use of .assertRaises?
4. Would be nice to resolve some of the XXXes, but I realise that this may be difficult/impossible given the requirement for backwards-compatibility
|
|
msg51040 - (view) |
Author: Collin Winter (collinwinter) |
Date: 2007-01-30 06:30 |
|
Point 1: I vaguely remember having a reason for not doing 'del sys.modules[module_name]' back when I wrote the suite, but I can't think of what it is now. I've amended the suite to use that line.
Point 2: I've added a list at the top of things that have yet to be tested. The TestCase.assert* and TestCase.fail* methods still need explicit tests, though most are tested implicitly in the test suite itself.
Point 3: I think assertRaises is ugly : )
Point 4: I've given up on resolving a number of the XXXs in 2.x, though I'm working on a rewrite of unittest for 3.x that will resolve all such issues.
Thanks!
File Added: test_unittest.py
|
|
msg51041 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2007-03-07 09:11 |
|
Committed as part of rev. 54199. Not backporting to 2.5.
|
|
| Date |
User |
Action |
Args |
| 2006-09-01 02:44:08 | collinwinter | create | |
|