mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #1238 from oczkers/master
cleanup (remove max_retries test)
This commit is contained in:
@@ -366,26 +366,6 @@ class RequestsTestCase(unittest.TestCase):
|
||||
r = requests.Request(url=HTTPBIN)
|
||||
self.assertRaises(ValueError, requests.Session().send, r)
|
||||
|
||||
def test_can_specify_retries(self):
|
||||
# monkey patch urlopen
|
||||
from requests.packages.urllib3.poolmanager import HTTPConnectionPool
|
||||
old_urlopen = HTTPConnectionPool.urlopen
|
||||
|
||||
max_retries_used = []
|
||||
def urlopen(*args, **kwargs):
|
||||
"""Save what value we used for retries each time we call urlopen."""
|
||||
max_retries_used.append(kwargs.get('retries'))
|
||||
return old_urlopen(*args, **kwargs)
|
||||
|
||||
HTTPConnectionPool.urlopen = urlopen
|
||||
|
||||
# do the request and check that max_retries was passed through
|
||||
requests.get(httpbin('get'), max_retries=5)
|
||||
self.assertEqual(max_retries_used, [5])
|
||||
|
||||
# undo monkey patch
|
||||
HTTPConnectionPool.urlopen = old_urlopen
|
||||
|
||||
def test_http_error(self):
|
||||
error = requests.exceptions.HTTPError()
|
||||
self.assertEqual(error.response, None)
|
||||
|
||||
Reference in New Issue
Block a user