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

Commit 6c82103

Browse files
committed
Fixup coverage test config for new compat module
1 parent bca22f4 commit 6c82103

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Diff for: .coveragerc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[run]
2-
omit=hyper/httplib_compat.py
2+
omit =
3+
hyper/compat.py
4+
hyper/httplib_compat.py

Diff for: conftest.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
import pytest
33
import os
44
import json
5+
import sys
56

6-
from hyper.compat import open
7+
if sys.version_info[0] == 2:
8+
from codecs import open
79

810
# This pair of generator expressions are pretty lame, but building lists is a
911
# bad idea as I plan to have a substantial number of tests here.

Diff for: hyper/compat.py

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
is_py3 = (_ver[0] == 3)
1919

2020
if is_py2:
21-
from codecs import open
2221
from urlparse import urlparse
2322

2423
def to_byte(char):
@@ -41,5 +40,4 @@ def to_byte(char):
4140
def decode_hex(b):
4241
return bytes.fromhex(b)
4342

44-
open = open
4543
zlib_compressobj = zlib.compressobj

Diff for: hyper/http20/tls.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
cert_loc = path.join(path.dirname(__file__), '..', 'certs.pem')
2929

3030

31-
if is_py3:
31+
if is_py3: # pragma: no cover
3232
def wrap_socket(socket, server_hostname):
3333
"""
3434
A vastly simplified SSL wrapping function. We'll probably extend this to
@@ -45,13 +45,13 @@ def wrap_socket(socket, server_hostname):
4545
wrapped = _context.wrap_socket(socket) # pragma: no cover
4646
assert wrapped.selected_npn_protocol() == 'HTTP-draft-09/2.0'
4747
return wrapped
48-
else:
48+
else: # pragma: no cover
4949
def wrap_socket(socket, server_hostname):
5050
return ssl.wrap_socket(socket, ssl_version=ssl.PROTOCOL_SSLv23,
5151
ca_certs=cert_loc, cert_reqs=_verify_mode)
5252

5353

54-
def _init_context():
54+
def _init_context(): # pragma: no cover
5555
"""
5656
Creates the singleton SSLContext we use.
5757
"""

0 commit comments

Comments
 (0)