Merge pull request #260 from hugovk/deprecation-warnings

Close HTTPSConnection in case of exception
This commit is contained in:
Hugo 2018-04-11 16:38:47 +03:00 committed by GitHub
commit a144ce407d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

3
.gitignore vendored
View file

@ -47,8 +47,9 @@ htmlcov/
.cache .cache
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*,cover *.cover
.hypothesis/ .hypothesis/
.pytest_cache/
# Translations # Translations
*.mo *.mo

View file

@ -857,8 +857,10 @@ class _Request(object):
except Exception as e: except Exception as e:
raise MalformedResponseError(self.network, e) raise MalformedResponseError(self.network, e)
self._check_response_for_errors(response_text) try:
conn.close() self._check_response_for_errors(response_text)
finally:
conn.close()
return response_text return response_text
def execute(self, cacheable=False): def execute(self, cacheable=False):

4
pytest.ini Normal file
View file

@ -0,0 +1,4 @@
[pytest]
filterwarnings =
once::DeprecationWarning
once::PendingDeprecationWarning