My guess is you mixed tabs and spaces. One tab is always treated by the python interpreter as being equal to eight spaces, which is two indentation levels in your code.
Though if it were exactly as you show it, you'd be getting a syntax error, because even there, it looks like the indentation of your `def test_T1(self):` line is off by one column, relative to pass, and by three columns relative to the other methods. Cheers, Cliff On Mon, 2010-05-10 at 13:38 +0100, John Maclean wrote: > 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 > > ''' -- http://mail.python.org/mailman/listinfo/python-list