escribi�:
Hello, everyone.Do you have any reason for such meta-testing?
Why do unitest.TestCase grand-grandchildren not work?
I've created a unittest.TestCase descendant, which contains the setUp()
and
tearDown() for testing some components of a web framework. Every
application based on this framework should subclass this base class once,
and the rest of the test cases must also subclass the base TestCase of
the
application (which is a direct descendant of my descendant of TestCase).
If you want to ensure that all derived Test classes correctly set the
database and model attributes, just check that condition in another test
method on your base class (DBTest).
Currently you are trying to check whether the code is actually checking
the condition... I'm not sure of the usefulness of such meta-testing, even
if it worked.
But grandchildren of my TestCase don't work, and I get this weird error:I get a different exception: ValueError: no such test method in <class>Â* File "/usr/lib/python2.5/unittest.py", line 248, in run
Â* Â* testMethod = getattr(self, self._testMethodName)
AttributeError: 'TestDatabaseGrandChildTesting' object has no
attribute '_testMethodName'
'__main__.EmptyTestCase'>: runTest, which is perfectly reasonable given
that you're constructing TestCase instances by hand, with no arguments -
so the default test method "runTest" is used, and you haven't provided
such method.
--
Gabriel Genellina