unittest not being run

  • Follow


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

'''
0
Reply John 5/10/2010 12:38:49 PM


0 Replies
87 Views

(page loaded in 0.042 seconds)

Similiar Articles:





7/26/2012 12:16:03 AM


Reply: