[TIP] Grand children of TestCase don't work

Gustavo Narea me at gustavonarea.net
Wed Aug 20 04:07:06 PDT 2008


Hello, Jonathan.

It fails even without call_dad: http://paste.turbogears.org/paste/4721

I think the real problem is that it's impossible to test TestCase objects:
> >>> import unittest
> >>> class algo(unittest.TestCase):
> ...     i_am_a_variable = True
> ...
> >>> my_var = algo()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.5/unittest.py", line 209, in __init__
>     (self.__class__, methodName)
> ValueError: no such test method in <class '__main__.algo'>: runTest

Am I right?

Thanks,

Gustavo.


Jonathan Lange wrote:

> On Wed, Aug 20, 2008 at 6:58 AM, Gustavo Narea <me at gustavonarea.net>
> wrote:
>> Hello, everyone.
>>
>> I've created a unittest.TestCase descendant, which contains some
>> utilities 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).
>>
> 
> You have to call the constructor of TestCase. It's the call_dad
> business that's causing you problems.
> 
> jml

-- 
Gustavo Narea.
http://gustavonarea.net/

Get GNU/Linux! http://www.getgnulinux.org/




More information about the testing-in-python mailing list