This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree 4 files changed +9
-7
lines changed
4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
[run]
2
- omit =hyper/httplib_compat.py
2
+ omit =
3
+ hyper/compat.py
4
+ hyper/httplib_compat.py
Original file line number Diff line number Diff line change 2
2
import pytest
3
3
import os
4
4
import json
5
+ import sys
5
6
6
- from hyper .compat import open
7
+ if sys .version_info [0 ] == 2 :
8
+ from codecs import open
7
9
8
10
# This pair of generator expressions are pretty lame, but building lists is a
9
11
# bad idea as I plan to have a substantial number of tests here.
Original file line number Diff line number Diff line change 18
18
is_py3 = (_ver [0 ] == 3 )
19
19
20
20
if is_py2 :
21
- from codecs import open
22
21
from urlparse import urlparse
23
22
24
23
def to_byte (char ):
@@ -41,5 +40,4 @@ def to_byte(char):
41
40
def decode_hex (b ):
42
41
return bytes .fromhex (b )
43
42
44
- open = open
45
43
zlib_compressobj = zlib .compressobj
Original file line number Diff line number Diff line change 28
28
cert_loc = path .join (path .dirname (__file__ ), '..' , 'certs.pem' )
29
29
30
30
31
- if is_py3 :
31
+ if is_py3 : # pragma: no cover
32
32
def wrap_socket (socket , server_hostname ):
33
33
"""
34
34
A vastly simplified SSL wrapping function. We'll probably extend this to
@@ -45,13 +45,13 @@ def wrap_socket(socket, server_hostname):
45
45
wrapped = _context .wrap_socket (socket ) # pragma: no cover
46
46
assert wrapped .selected_npn_protocol () == 'HTTP-draft-09/2.0'
47
47
return wrapped
48
- else :
48
+ else : # pragma: no cover
49
49
def wrap_socket (socket , server_hostname ):
50
50
return ssl .wrap_socket (socket , ssl_version = ssl .PROTOCOL_SSLv23 ,
51
51
ca_certs = cert_loc , cert_reqs = _verify_mode )
52
52
53
53
54
- def _init_context ():
54
+ def _init_context (): # pragma: no cover
55
55
"""
56
56
Creates the singleton SSLContext we use.
57
57
"""
You can’t perform that action at this time.
0 commit comments