]> granicus.if.org Git - python/commitdiff
[2.7] bpo-25287: Backport new tests for crypt and skip test_crypt on OpenBSD. (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 24 Oct 2017 20:35:22 +0000 (23:35 +0300)
committerGitHub <noreply@github.com>
Tue, 24 Oct 2017 20:35:22 +0000 (23:35 +0300)
(cherry picked from commit f52dff611cff2fb9e90340b4787eda50ab2d40c6)

Lib/test/test_crypt.py

index 4db200d4031b740764867b62bffe184dc99ed0ba..7cd9c71981a67e185c0a3dac998159b21f7d3764 100644 (file)
@@ -1,14 +1,20 @@
+import sys
 from test import test_support
 import unittest
 
 crypt = test_support.import_module('crypt')
 
+if sys.platform.startswith('openbsd'):
+    raise unittest.SkipTest('The only supported method on OpenBSD is Blowfish')
+
 class CryptTestCase(unittest.TestCase):
 
     def test_crypt(self):
-        c = crypt.crypt('mypassword', 'ab')
-        if test_support.verbose:
-            print 'Test encryption: ', c
+        cr = crypt.crypt('mypassword', 'ab')
+        if cr is not None:
+            cr2 = crypt.crypt('mypassword', cr)
+            self.assertEqual(cr2, cr)
+
 
 def test_main():
     test_support.run_unittest(CryptTestCase)