Message114471
Hi,
I think this was misdiagnosed:
from unittest.py in 2.6, loadTestFromName:
elif hasattr(obj, '__call__'):
test = obj()
if isinstance(test, TestSuite):
return test
elif isinstance(test, TestCase):
return TestSuite([test])
else:
raise TypeError("calling %s returned %s, not a test" %
(obj, test))
so it supports callables, such as the test_suite function that
Rob is passing. Therefore I don't think this is a feature request,
and "use load_tests" isn't an appropriate resolution.
I haven't checked what 2.7 and later do, but going on the above
my diagnosis of this is the following.
1. test_suite is correctly identified as a callable
2. It is called an returns a unittest.TestSuite
3. It is not matched as being a a TestSuite or a TestCase, and so the error is raised.
The reason it is not matched is that when run as -m unittest, the unittest module is __main__, and so the TestSuite in the isinstance check is a unittest.TestSuite against a __main__.TestSuite, which won't match.
Therefore I think this is a legitimate bug, in at least 2.6.
Thanks,
James |
|
Date |
User |
Action |
Args |
2010-08-21 01:07:41 | james-w | set | recipients:
+ james-w, exarkun, rbcollins, michael.foord |
2010-08-21 01:07:40 | james-w | set | messageid: <1282352860.8.0.988983335553.issue7501@psf.upfronthosting.co.za> |
2010-08-21 01:07:38 | james-w | link | issue7501 messages |
2010-08-21 01:07:37 | james-w | create | |
|