diff -r 5f04daa34a55 Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py Tue Apr 14 09:59:09 2015 -0400 +++ b/Lib/test/test_urllib.py Tue Apr 14 14:33:51 2015 -0400 @@ -296,6 +296,23 @@ finally: self.unfakehttp() + def test_maxtries_limit_per_request(self): + # Ticket #12923: make sure independent requests each use their + # own retry limit. + for i in range(_urlopener.maxtries): + self.fakehttp(b'''HTTP/1.1 302 Found +Date: Wed, 02 Jan 2008 03:03:54 GMT +Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e +Location: file://guidocomputer.athome.com:/python/license +Connection: close +Content-Type: text/html; charset=iso-8859-1 +''') + try: + self.assertRaises(urllib.error.HTTPError, urlopen, + "http://something") + finally: + self.unfakehttp() + def test_empty_socket(self): # urlopen() raises OSError if the underlying socket does not send any # data. (#1680230)