diff options
| author | hodbn <hodbn@users.noreply.github.com> | 2020-04-01 03:36:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-01 14:36:23 +0400 |
| commit | a9508d8d8ac58ed95bf06d8970382664af4e91e3 (patch) | |
| tree | 045cbfc464efe18d95a312f158623aec093b3566 /test/with_dummyserver | |
| parent | 39e580ef9990148d701d10b2745c47caf27aa27b (diff) | |
| download | urllib3-a9508d8d8ac58ed95bf06d8970382664af4e91e3.tar.gz | |
Add context to find_unused_port (#1837)
Diffstat (limited to 'test/with_dummyserver')
| -rw-r--r-- | test/with_dummyserver/test_connectionpool.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/with_dummyserver/test_connectionpool.py b/test/with_dummyserver/test_connectionpool.py index 763e3aeb..8258ce14 100644 --- a/test/with_dummyserver/test_connectionpool.py +++ b/test/with_dummyserver/test_connectionpool.py @@ -349,11 +349,11 @@ class TestConnectionPool(HTTPDummyServerTestCase): def test_connection_error_retries(self): """ ECONNREFUSED error should raise a connection error, with retries """ - port = find_unused_port() - with HTTPConnectionPool(self.host, port) as pool: - with pytest.raises(MaxRetryError) as e: - pool.request("GET", "/", retries=Retry(connect=3)) - assert type(e.value.reason) == NewConnectionError + with find_unused_port() as port: + with HTTPConnectionPool(self.host, port) as pool: + with pytest.raises(MaxRetryError) as e: + pool.request("GET", "/", retries=Retry(connect=3)) + assert type(e.value.reason) == NewConnectionError def test_timeout_success(self): timeout = Timeout(connect=3, read=5, total=None) |
