summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rivera <rivera@joel.mx>2016-03-07 23:18:18 -0600
committerJoel Rivera <rivera@joel.mx>2016-03-07 23:18:18 -0600
commita5b28b151a90cb5ac37710380825abcc0231384a (patch)
tree5a9709351b9496794f412b403ad739cb0325c2f0
parent94d6a3e8fe973169e07d02374de4c997edeb4929 (diff)
downloadcherrypy-a5b28b151a90cb5ac37710380825abcc0231384a.tar.gz
Mokey patch the HTTP Request because of a socket buffering error in
python 3 for the ``cherrypy.tests.test_conn.test_HTTP11_pipelining`` testcase. Upstream cpython bug: https://bugs.python.org/issue23377 Fixes issue #1315
-rw-r--r--cherrypy/test/test_conn.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/cherrypy/test/test_conn.py b/cherrypy/test/test_conn.py
index 703e6dfd..6577e03a 100644
--- a/cherrypy/test/test_conn.py
+++ b/cherrypy/test/test_conn.py
@@ -8,7 +8,14 @@ import errno
import cherrypy
from cherrypy._cpcompat import HTTPConnection, HTTPSConnection, NotConnected
-from cherrypy._cpcompat import BadStatusLine, ntob, tonative, urlopen, unicodestr
+from cherrypy._cpcompat import (
+ BadStatusLine,
+ ntob,
+ tonative,
+ urlopen,
+ unicodestr,
+ py3k
+)
from cherrypy.test import webtest
@@ -434,6 +441,12 @@ class PipelineTests(helper.CPWebCase):
# Retrieve previous response
response = conn.response_class(conn.sock, method="GET")
+ # there is a bug in python3 regarding the buffering of
+ # ``conn.sock``. Until that bug get's fixed we will
+ # monkey patch the ``reponse`` instance.
+ # https://bugs.python.org/issue23377
+ if py3k:
+ response.fp = conn.sock.makefile("rb", 0)
response.begin()
body = response.read(13)
self.assertEqual(response.status, 200)