
I noticed many tests have: if __name__ == '__main__': unittest.main() But this seems to ignore test_suite(), so it's not really very useful. This seems more helpful: if __name__ == '__main__': print 'to test use test.py %s' % __file__ -- Ian Bicking | ianb@colorstudy.com | http://blog.ianbicking.org | Write code, do good | http://topp.openplans.org/careers

Ian Bicking wrote:
I noticed many tests have:
if __name__ == '__main__': unittest.main()
But this seems to ignore test_suite(), so it's not really very useful.
You can do:: if __name__ == '__main__': unittest.main(defaultTest='test_suite') which seems to work.
This seems more helpful:
if __name__ == '__main__': print 'to test use test.py %s' % __file__
+1 Not-really-having-to-say-anything-in-lxml-development-ly Philipp -- http://worldcookery.com -- Professional Zope documentation and training

On 5/29/07, Ian Bicking <ianb@colorstudy.com> wrote:
I noticed many tests have:
if __name__ == '__main__': unittest.main()
But this seems to ignore test_suite(), so it's not really very useful. This seems more helpful:
if __name__ == '__main__': print 'to test use test.py %s' % __file__
I think you can also do: unittest.main(defaultTest='test_suite') or something very similar to that. -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214

Ian Bicking wrote:
I noticed many tests have:
if __name__ == '__main__': unittest.main()
But this seems to ignore test_suite(), so it's not really very useful. This seems more helpful:
if __name__ == '__main__': print 'to test use test.py %s' % __file__
I always run the tests through the test.py testrunner. I tend to remove the __name__ == '__main__' bits and rely on the test runner to collect tests completely. I imagine someone put this in for a reason, though. Perhaps it was even me, long ago? Regards, Martijn
participants (4)
-
Ian Bicking
-
Martijn Faassen
-
Philipp von Weitershausen
-
Sidnei da Silva