]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-25172: Reduce scope of crypt import tests (GH-17881)
authorSteve Dower <steve.dower@python.org>
Thu, 9 Jan 2020 17:00:29 +0000 (09:00 -0800)
committerGitHub <noreply@github.com>
Thu, 9 Jan 2020 17:00:29 +0000 (09:00 -0800)
Lib/test/test_crypt.py

index d29e005fdad50670f4a27d78b201d2b832257489..5dc83b4ecbfa008d78d41ef2d51bd1784ba2d111 100644 (file)
@@ -6,20 +6,21 @@ try:
     import crypt
     IMPORT_ERROR = None
 except ImportError as ex:
+    if sys.platform != 'win32':
+        raise unittest.SkipTest(str(ex))
     crypt = None
     IMPORT_ERROR = str(ex)
 
 
-@unittest.skipIf(crypt, 'This should only run on windows')
+@unittest.skipUnless(sys.platform == 'win32', 'This should only run on windows')
+@unittest.skipIf(crypt, 'import succeeded')
 class TestWhyCryptDidNotImport(unittest.TestCase):
-    def test_failure_only_for_windows(self):
-        self.assertEqual(sys.platform, 'win32')
 
     def test_import_failure_message(self):
         self.assertIn('not supported', IMPORT_ERROR)
 
 
-@unittest.skipUnless(crypt, 'Not supported on Windows')
+@unittest.skipUnless(crypt, 'crypt module is required')
 class CryptTestCase(unittest.TestCase):
 
     def test_crypt(self):