Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit b2d2b7f

Browse files
committed
Use pytest.skip
1 parent 0cc874c commit b2d2b7f

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test/test_hyper_SSLContext.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"""
55
import os
66

7+
import pytest
8+
79
from hyper.compat import ssl
810
try:
911
from hyper.ssl_compat import SSLContext
@@ -21,17 +23,21 @@ class TestHyperSSLContext(object):
2123
"""
2224
Tests hyper SSLContext
2325
"""
26+
27+
@pytest.mark.skipif(
28+
SSLContext is None,
29+
reason='requires PyOpenSSL'
30+
)
2431
def test_custom_context_with_cert_as_file(self):
2532
# Test using hyper's own SSLContext
26-
if SSLContext is not None:
27-
context = SSLContext(ssl.PROTOCOL_SSLv23)
28-
context.verify_mode = ssl.CERT_NONE
29-
context.check_hostname = False
30-
31-
# Test that we can load in a cert and key protected by a passphrase,
32-
# from files.
33-
context.load_cert_chain(
34-
certfile=CLIENT_CERT_FILE,
35-
keyfile=CLIENT_KEY_FILE,
36-
password='abc123'
37-
)
33+
context = SSLContext(ssl.PROTOCOL_SSLv23)
34+
context.verify_mode = ssl.CERT_NONE
35+
context.check_hostname = False
36+
37+
# Test that we can load in a cert and key protected by a passphrase,
38+
# from files.
39+
context.load_cert_chain(
40+
certfile=CLIENT_CERT_FILE,
41+
keyfile=CLIENT_KEY_FILE,
42+
password='abc123'
43+
)

0 commit comments

Comments
 (0)