diff options
| author | Benjamin Wohlwend <piquadrat@gmail.com> | 2017-05-15 15:06:25 +0200 |
|---|---|---|
| committer | Benjamin Wohlwend <piquadrat@gmail.com> | 2017-06-07 11:37:58 +0200 |
| commit | 496ab444c1bad0ca5d7b7a52c7c00a929f6b2f86 (patch) | |
| tree | 59c9278ec5b55a03b0a11e1a3b87ae26552509df /test/test_connectionpool.py | |
| parent | 3695c67a7a417f3e06890983070a469c46f59fdf (diff) | |
| download | urllib3-496ab444c1bad0ca5d7b7a52c7c00a929f6b2f86.tar.gz | |
Ensured that SSLErrors will be retried
Fixes #1112
Test fixes are due to the fact that SSLErrors are now wrapped in
a MaxRetryError.
Diffstat (limited to 'test/test_connectionpool.py')
| -rw-r--r-- | test/test_connectionpool.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test_connectionpool.py b/test/test_connectionpool.py index 3ef1ec2e..d8b8a839 100644 --- a/test/test_connectionpool.py +++ b/test/test_connectionpool.py @@ -193,18 +193,19 @@ class TestConnectionPool(object): def _raise(ex): raise ex() - def _test(exception, expect): + def _test(exception, expect, reason=None): pool._make_request = lambda *args, **kwargs: _raise(exception) - with pytest.raises(expect): + with pytest.raises(expect) as excinfo: pool.request('GET', '/') - + if reason is not None: + assert isinstance(excinfo.value.reason, reason) assert pool.pool.qsize() == POOL_SIZE # Make sure that all of the exceptions return the connection # to the pool _test(Empty, EmptyPoolError) - _test(BaseSSLError, SSLError) - _test(CertificateError, SSLError) + _test(BaseSSLError, MaxRetryError, SSLError) + _test(CertificateError, MaxRetryError, SSLError) # The pool should never be empty, and with these two exceptions # being raised, a retry will be triggered, but that retry will |
