Skip to content

Commit

Permalink
Use http_client for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Nov 16, 2017
1 parent 2d5a188 commit eaf8435
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cheroot/test/test_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import socket
import time

from six.moves import range
from six.moves import range, http_client, urllib

import six
import pytest

from cheroot._compat import NotConnected, BadStatusLine
from cheroot._compat import urlopen
from cheroot.test import helper, webtest


Expand Down Expand Up @@ -107,7 +105,7 @@ def test_HTTP11_persistent_connections(self):
self.assertHeader('Connection', 'close')

# Make another request on the same connection, which should error.
self.assertRaises(NotConnected, self.getPage, '/pov')
self.assertRaises(http_client.NotConnected, self.getPage, '/pov')

def test_Streaming_no_len_11(self):
self._streaming_11(set_cl=False)
Expand Down Expand Up @@ -166,7 +164,7 @@ def _streaming_11(self, set_cl):

# Make another request on the same connection, which should
# error.
self.assertRaises(NotConnected, self.getPage, '/pov')
self.assertRaises(http_client.NotConnected, self.getPage, '/pov')

# Try HEAD.
# See http://www.bitbucket.org/cherrypy/cherrypy/issue/864.
Expand Down Expand Up @@ -210,7 +208,7 @@ def _streaming_10(self, set_cl):
self.assertNoHeader('Transfer-Encoding')

# Make another request on the same connection, which should error.
self.assertRaises(NotConnected, self.getPage, '/pov')
self.assertRaises(http_client.NotConnected, self.getPage, '/pov')

def test_HTTP10_to_10_KeepAlive(self):
self.httpserver.protocol = 'HTTP/1.0'
Expand Down Expand Up @@ -322,7 +320,7 @@ def test_HTTP11_Timeout_after_request(self):
response.begin()
except Exception as ex:
if not isinstance(ex,
(socket.error, BadStatusLine)):
(socket.error, http_client.BadStatusLine)):
self.fail("Writing to timed out socket didn't fail"
' as it should have: %s' % ex)
else:
Expand Down Expand Up @@ -355,7 +353,7 @@ def test_HTTP11_Timeout_after_request(self):
response.begin()
except Exception as ex:
if not isinstance(ex,
(socket.error, BadStatusLine)):
(socket.error, http_client.BadStatusLine)):
self.fail("Writing to timed out socket didn't fail"
' as it should have: %s' % ex)
else:
Expand Down Expand Up @@ -666,8 +664,10 @@ def test_Content_Length_out_postheaders(self):
def test_598(self):
self.httpserver.protocol = 'HTTP/1.1'
self.PROTOCOL = 'HTTP/1.1'
remote_data_conn = urlopen('%s://%s:%s/one_megabyte_of_a' %
(self.scheme, self.HOST, self.PORT))
remote_data_conn = urllib.request.urlopen(
'%s://%s:%s/one_megabyte_of_a'
% (self.scheme, self.HOST, self.PORT)
)
buf = remote_data_conn.read(512)
time.sleep(timeout * 0.6)
remaining = (1024 * 1024) - 512
Expand Down

0 comments on commit eaf8435

Please sign in to comment.