unittest help needed!
Oltmans
rolf.oltmans at gmail.com
Thu Jan 14 13:33:55 EST 2010
Hi Python gurus,
I'm quite new to Python and have a problem. Following code resides in
a file named test.py
---
import unittest
class result(unittest.TestResult):
pass
class tee(unittest.TestCase):
def test_first(self):
print 'first test'
print '-------------'
def test_second(self):
print 'second test'
print '-------------'
def test_final(self):
print 'final method'
print '-------------'
r = result()
suite = unittest.defaultTestLoader.loadTestsFromName('test.tee')
suite.run(r)
---
Following is the output when I run it
---
final method
-------------
first test
-------------
second test
-------------
final method
-------------
first test
-------------
second test
-------------
---
Looks like it's running every test twice, I cannot figure out why?
Shouldn't output be more like
---
final method
-------------
first test
-------------
second test
-------------
---
Please help me solve the problem. Thanks in advance.
More information about the Python-list
mailing list