help with unittest

Danny Shevitz shevitz at lanl.gov
Fri Jan 23 17:54:02 EST 2004


Why doesn't the following code snippet work?

The error is

ImportError: No module named myTestCase2

TIA,
Danny

%<--------------------------------------------------------------------

# import the unittest module
import unittest

# create the first testcase
class myTestCase(unittest.TestCase):

 def testTrue(self):
  self.assertEqual(1,1)

# create the first testcase
class myTestCase2(unittest.TestCase):

 def testTrue(self):
  self.assertEqual(1,1)


if __name__ == '__main__':
 #unittest.main()
 suite =
unittest.defaultTestLoader.loadTestsFromNames(['myTestCase2.testTrue'])
 unittest.TextTestRunner().run(suite)








More information about the Python-list mailing list