James Westby <[email protected]> added the comment:
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
----------
nosy: +james-w
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7501>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com