Skip to content

Commit ed36781

Browse files
authored
bpo-25172: Reduce scope of crypt import tests (GH-17881)
1 parent eef1b02 commit ed36781

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Lib/test/test_crypt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@
66
import crypt
77
IMPORT_ERROR = None
88
except ImportError as ex:
9+
if sys.platform != 'win32':
10+
raise unittest.SkipTest(str(ex))
911
crypt = None
1012
IMPORT_ERROR = str(ex)
1113

1214

13-
@unittest.skipIf(crypt, 'This should only run on windows')
15+
@unittest.skipUnless(sys.platform == 'win32', 'This should only run on windows')
16+
@unittest.skipIf(crypt, 'import succeeded')
1417
class TestWhyCryptDidNotImport(unittest.TestCase):
15-
def test_failure_only_for_windows(self):
16-
self.assertEqual(sys.platform, 'win32')
1718

1819
def test_import_failure_message(self):
1920
self.assertIn('not supported', IMPORT_ERROR)
2021

2122

22-
@unittest.skipUnless(crypt, 'Not supported on Windows')
23+
@unittest.skipUnless(crypt, 'crypt module is required')
2324
class CryptTestCase(unittest.TestCase):
2425

2526
def test_crypt(self):

0 commit comments

Comments
 (0)