Skip to content

Commit

Permalink
bpo-25172: Reduce scope of crypt import tests (pythonGH-17881)
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba authored Jan 9, 2020
1 parent eef1b02 commit ed36781
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Lib/test/test_crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


@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):
Expand Down

0 comments on commit ed36781

Please sign in to comment.