diff options
author | Steve Dower <steve.dower@python.org> | 2020-01-09 17:00:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 17:00:29 (GMT) |
commit | ed367815eeb9329c48a86a8a7fa3186e27a10f2c (patch) | |
tree | 0ed72444c03135dc7a9a63c8b3c6601f0a8edee7 | |
parent | eef1b027ab70704bcaa60a089e4ae1592c504b86 (diff) | |
download | cpython-ed367815eeb9329c48a86a8a7fa3186e27a10f2c.zip cpython-ed367815eeb9329c48a86a8a7fa3186e27a10f2c.tar.gz cpython-ed367815eeb9329c48a86a8a7fa3186e27a10f2c.tar.bz2 |
bpo-25172: Reduce scope of crypt import tests (GH-17881)
-rw-r--r-- | Lib/test/test_crypt.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py index d29e005..5dc83b4 100644 --- a/Lib/test/test_crypt.py +++ b/Lib/test/test_crypt.py @@ -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): |