Trouble using example in docs for unittest

Daniel Eloff danieleloff at
Sat Jul 17 16:16:56 EDT 2004

I've got a simple test case class (derived from TestCase() of course)
with a setUp(), tearDown() and testFoo() methods.


Then I have the following code (practically word for word from the
example in the docs)


suite = TestSuite()

suite.addTest( unittest.makeSuite( TestDebugTrace, 'test' ) )

unittest.TextTestRunner( verbosity = 2 ).run( suite )


Traceback (most recent call last):

  File "XXX\", line 37, in ?

    suite.addTest( unittest.makeSuite( TestDebugTrace, 'test' ) )

  File "C:\Python23\lib\", line 545, in makeSuite

    return _makeLoader(prefix, sortUsing,

  File "C:\Python23\lib\", line 446, in loadTestsFromTestCase


  File "C:\Python23\lib\", line 517, in getTestCaseNames

    for baseclass in testCaseClass.__bases__:

AttributeError: 'function' object has no attribute '__bases__'


I have no experience with PyTest, nor did I find the answer to the
problem by skimming through the docs.


What am I doing wrong? (I very much doubt that this could be a bug)




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list