unittest not being run

J

John Maclean

hi,

can some one explain why the __first__ test is not being run?

#!/usr/bin/env python
import unittest # {{{
class T1TestCase(unittest.TestCase):

def setUp(self):
pass # can we use global variables here?

def tearDown(self):
pass # garbage collection

def test_T1(self):
'''this test aint loading'''
self.assertEquals(1, 0)

def test_T2(self): ## test method names begin 'test*'
self.assertEquals((1 + 2), 3)
self.assertEquals(0 + 1, 1)

def test_T3(self):
self.assertEquals((0 * 10), 0)
self.assertEquals((5 * 8), 40)

# the output is better. prints each test and ok or fail
suite = unittest.TestLoader().loadTestsFromTestCase(T1TestCase)
unittest.TextTestRunner(verbosity=2).run(suite) # }}}


''' halp!

the first test ain't loading...

python blaht.py
test_T2 (__main__.T1TestCase) ... ok
test_T3 (__main__.T1TestCase) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.000s

OK

'''
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top