[Python-checkins] r54208 - python/branches/release25-maint/Lib/unittest.py
Georg Brandl
g.brandl at gmx.net
Thu Mar 8 08:47:54 CET 2007
Neal Norwitz schrieb:
> I'm not sure it's the best thing to backport this. I agree with the
> change, but worry that people writing bad unit tests will suddenly
> have it break. They might have the proper signature, even if they
> don't inherit from the right classes.
>> I guess the only part I'm worried about is the second if in addTest.
> The callable and basestring checks will just error out earlier which
> definitely seems reasonable.
But this
+ if (isinstance(test, (type, types.ClassType)) and
+ issubclass(test, (TestCase, TestSuite))):
+ raise TypeError("TestCases and TestSuites must be instantiated "
+ "before passing them to addTest()")
does allow for tests that don't inherit from TestCase/Suite. It only checks
if the test is a TestCase, which is the common case, whether is instantiated.
Georg
More information about the Python-checkins
mailing list