diff -r 6da90e44c6a0 Lib/test/test_crypt.py --- a/Lib/test/test_crypt.py Thu Jan 10 06:36:07 2013 -0800 +++ b/Lib/test/test_crypt.py Thu Jan 10 10:52:01 2013 -0600 @@ -1,7 +1,11 @@ from test import support import unittest -crypt = support.import_module('crypt') +def setUpModule(): + # this import will raise unittest.SkipTest if _crypt doesn't exist, + # so it has to be done in setUpModule for test discovery to work + global crypt + crypt = support.import_module('crypt') class CryptTestCase(unittest.TestCase): @@ -29,8 +33,5 @@ self.assertTrue(len(crypt.methods) >= 1) self.assertEqual(crypt.METHOD_CRYPT, crypt.methods[-1]) -def test_main(): - support.run_unittest(CryptTestCase) - if __name__ == "__main__": - test_main() + unittest.main()