Skip to content

Commit

Permalink
Fix test collection when openssl does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
hexchain committed Feb 19, 2022
1 parent 94f19af commit da56ed7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_public_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@

_openssl_available = _openssl_version != b''

if _openssl_available:
_openssl_curves = run('openssl ecparam -list_curves')
else:
_openssl_curves = b''

# The openssl "-v2prf" option is only available in OpenSSL 1.0.2 or later
_openssl_supports_v2prf = _openssl_version >= b'OpenSSL 1.0.2'

Expand Down Expand Up @@ -2260,9 +2265,9 @@ def test_ec_explicit(self):
'-param_enc explicit' % curve)
asyncssh.read_private_key('priv')

@unittest.skipIf(b'secp224r1' not in run('openssl ecparam -list_curves'),
"this openssl doesn't support secp224r1")
@unittest.skipIf(not _openssl_available, "openssl isn't available")
@unittest.skipIf(b'secp224r1' not in _openssl_curves,
"this openssl doesn't support secp224r1")
def test_ec_explicit_unknown(self):
"""Import EC key with unknown explicit parameters"""

Expand Down

0 comments on commit da56ed7

Please sign in to comment.