This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 5
5
import os
6
6
7
7
from hyper .compat import ssl
8
- from hyper .ssl_compat import SSLContext
8
+ try :
9
+ from hyper .ssl_compat import SSLContext
10
+ except ImportError :
11
+ SSLContext = None
9
12
10
13
11
14
TEST_DIR = os .path .abspath (os .path .dirname (__file__ ))
@@ -20,14 +23,15 @@ class TestHyperSSLContext(object):
20
23
"""
21
24
def test_custom_context_with_cert_as_file (self ):
22
25
# Test using hyper's own SSLContext
23
- context = SSLContext (ssl .PROTOCOL_SSLv23 )
24
- context .verify_mode = ssl .CERT_NONE
25
- context .check_hostname = False
26
+ if SSLContext is not None :
27
+ context = SSLContext (ssl .PROTOCOL_SSLv23 )
28
+ context .verify_mode = ssl .CERT_NONE
29
+ context .check_hostname = False
26
30
27
- # Test that we can load in a cert and key protected by a passphrase,
28
- # from files.
29
- context .load_cert_chain (
30
- certfile = CLIENT_CERT_FILE ,
31
- keyfile = CLIENT_KEY_FILE ,
32
- password = 'abc123'
33
- )
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
+ )
You can’t perform that action at this time.
0 commit comments