Message179663
| Author |
chris.jerdonek |
| Recipients |
brett.cannon, chris.jerdonek, eric.araujo, ezio.melotti, python-dev, r.david.murray, serhiy.storchaka, terry.reedy, zach.ware |
| Date |
2013年01月11日.10:26:33 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1357899994.43.0.202242545804.issue16748@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
As suggested in the previous comment, here is simple code to find candidates for test duplication (TestCase subclasses subclassing other TestCase classes):
def find_dupes(mod):
objects = [getattr(mod, name) for name in sorted(dir(mod))]
classes = [obj for obj in objects if isinstance(obj, type) and
issubclass(obj, unittest.TestCase)]
for c in classes:
for d in classes:
if c is not d and issubclass(d, c):
print("%s: %s < %s" % (mod.__name__, c.__name__, d.__name__))
Out of curiosity, I ran a modified form of this against all test modules to find which ones fit this pattern and *already* rely on unittest discovery (i.e. don't have test_main()). We might want to adjust these as well. There were four: test_asyncore, test_configparser, test_heapq, test_ipaddress |
|