[Python-checkins] cpython (3.3): #16919: test_crypt now works with unittest test discovery. Patch by Zachary
ezio.melotti
python-checkins at python.org
Fri Jan 11 04:20:21 CET 2013
http://hg.python.org/cpython/rev/15ddd683c321
changeset: 81379:15ddd683c321
branch: 3.3
parent: 81375:cdf9142a0c84
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Fri Jan 11 05:18:45 2013 +0200
summary:
#16919: test_crypt now works with unittest test discovery. Patch by Zachary Ware.
files:
Lib/test/test_crypt.py | 11 ++++++-----
Misc/NEWS | 3 +++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py
--- a/Lib/test/test_crypt.py
+++ b/Lib/test/test_crypt.py
@@ -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()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -421,6 +421,9 @@
Tests
-----
+- Issue #16919: test_crypt now works with unittest test discovery.
+ Patch by Zachary Ware.
+
- Issue #16910: test_bytes, test_unicode, and test_userstring now work with
unittest test discovery. Patch by Zachary Ware.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list