Trouble using example in docs for unittest

Daniel Eloff danieleloff at hotmail.com
Sat Jul 17 22:16:56 CEST 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\debug_test.py", line 37, in ?

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

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

    return _makeLoader(prefix, sortUsing,
suiteClass).loadTestsFromTestCase(testCaseClass)

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

    self.getTestCaseNames(testCaseClass)))

  File "C:\Python23\lib\unittest.py", 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)

 

Cheers,

-Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040717/f84adee2/attachment.html>


More information about the Python-list mailing list