This repository was archived by the owner on Jan 13, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +30
-1
lines changed
Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1010 - TEST_RELEASE=false
1111 - TEST_RELEASE=true
1212 - NGHTTP2=true
13+ - HYPER_FAST_PARSE=true
1314
1415matrix :
1516 allow_failures :
Original file line number Diff line number Diff line change @@ -39,5 +39,9 @@ if [[ "$NGHTTP2" = true ]]; then
3939 sudo ldconfig
4040fi
4141
42+ if [[ " $HYPER_FAST_PARSE " = true ]]; then
43+ pip install pycohttpparser~=1.0
44+ fi
45+
4246pip install .
4347pip install -r test_requirements.txt
Original file line number Diff line number Diff line change 1010import socket
1111
1212from .response import HTTP11Response
13- from .parser import Parser
1413from ..tls import wrap_socket , H2_NPN_PROTOCOLS
1514from ..http20 .bufsocket import BufferedSocket
1615from ..common .headers import HTTPHeaderMap
1716from ..common .util import to_bytestring
1817from ..compat import bytes
1918
19+
20+ # We prefer pycohttpparser to the pure-Python interpretation
21+ try : # pragma: no cover
22+ from pycohttpparser .api import Parser
23+ except ImportError : # pragma: no cover
24+ from .parser import Parser
25+
26+
2027log = logging .getLogger (__name__ )
2128
2229BODY_CHUNKED = 1
Original file line number Diff line number Diff line change @@ -68,4 +68,7 @@ def resolve_install_requires():
6868 'hyper = hyper.cli:main' ,
6969 ],
7070 },
71+ extras_require = {
72+ 'fast' : ['pycohttpparser~=1.0' ],
73+ }
7174)
Original file line number Diff line number Diff line change 1818
1919
2020class TestHTTP11Connection (object ):
21+ def test_pycohttpparser_installs_correctly (self ):
22+ # This test is a debugging tool: if pycohttpparser is being tested by
23+ # Travis, we need to confirm it imports correctly. Hyper will normally
24+ # hide the import failure, so let's discover it here.
25+ # Alternatively, if we are *not* testing with nghttp2, this test should
26+ # confirm that it's not available.
27+ if os .environ .get ('HYPER_FAST_PARSE' ):
28+ import pycohttpparser
29+ else :
30+ with pytest .raises (ImportError ):
31+ import pycohttpparser
32+
33+ assert True
34+
2135 def test_initialization_no_port (self ):
2236 c = HTTP11Connection ('http2bin.org' )
2337
You can’t perform that action at this time.
0 commit comments