Skip to content

Commit

Permalink
Explicitly clear PoolManager by using context manager
Browse files Browse the repository at this point in the history
Fixes #6878

This is meant to solve ResourceWarning messages when WebDrivers are instanced with a KeepAlive=False.
  • Loading branch information
GQAssurance authored and AutomatedTester committed Aug 28, 2019
1 parent e94c30e commit 404c800
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def _request(self, method, url, body=None):

statuscode = resp.status
else:
http = urllib3.PoolManager(timeout=self._timeout)
resp = http.request(method, url, body=body, headers=headers)
with urllib3.PoolManager(timeout=self._timeout) as http:
resp = http.request(method, url, body=body, headers=headers)

statuscode = resp.status
if not hasattr(resp, 'getheader'):
Expand Down

0 comments on commit 404c800

Please sign in to comment.