On Jan 14, 11:46 pm, exar...@twistedmatrix.com wrote: > When you run test.py, it gets to the loadTestsFromName line. There, it > imports the module named "test" in order to load tests from it. To > import > that module, it runs test.py again. By the time it finishes running the > contents of test.py there, it has run all of your tests once, since part > of test.py is "suite.run(r)". Having finished that, the import of the > "test"
Many thanks, really appreciate your insight. Very helpful. I need a program design advice. I just want to know what's the gurus way of doing it? I've a unittest.TestCase derived class that have around 50 test methods. Design is almost similar to following --- import unittest class result(unittest.TestResult): pass class tee(unittest.TestCase): def test_first(self): print 'first test' process(123) def test_second(self): print 'second test' process(564) def test_third(self): print 'final method' process(127863) if __name__=="__main__": r = result() suite = unittest.defaultTestLoader.loadTestsFromName('test.tee') suite.run(r) --- As you can see, every test method is almost same. Only difference is that every test method is calling process() with a different value. Also, I've around 50 test methods coded that way. I just want to know: is there a way I can make things smaller/smarter/pythonic given the current design? If you think any information is missing please let me know. I will really really appreciate any insights. Many thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list