[Python-checkins] bpo-25172: Reduce scope of crypt import tests (GH-17881)
Steve Dower
webhook-mailer at python.org
Thu Jan 9 12:00:48 EST 2020
https://github.com/python/cpython/commit/ed367815eeb9329c48a86a8a7fa3186e27a10f2c
commit: ed367815eeb9329c48a86a8a7fa3186e27a10f2c
branch: master
author: Steve Dower <steve.dower at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-09T09:00:29-08:00
summary:
bpo-25172: Reduce scope of crypt import tests (GH-17881)
files:
M Lib/test/test_crypt.py
diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py
index d29e005fdad50..5dc83b4ecbfa0 100644
--- a/Lib/test/test_crypt.py
+++ b/Lib/test/test_crypt.py
@@ -6,20 +6,21 @@
import crypt
IMPORT_ERROR = None
except ImportError as ex:
+ if sys.platform != 'win32':
+ raise unittest.SkipTest(str(ex))
crypt = None
IMPORT_ERROR = str(ex)
- at unittest.skipIf(crypt, 'This should only run on windows')
+ at unittest.skipUnless(sys.platform == 'win32', 'This should only run on windows')
+ at 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)
- at unittest.skipUnless(crypt, 'Not supported on Windows')
+ at unittest.skipUnless(crypt, 'crypt module is required')
class CryptTestCase(unittest.TestCase):
def test_crypt(self):
More information about the Python-checkins
mailing list