diff --git a/.gitignore b/.gitignore index 12dc56a..8e4ffaf 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,9 @@ htmlcov/ .cache nosetests.xml coverage.xml -*,cover +*.cover .hypothesis/ +.pytest_cache/ # Translations *.mo diff --git a/pylast/__init__.py b/pylast/__init__.py index 195a649..16dc353 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -857,8 +857,10 @@ class _Request(object): except Exception as e: raise MalformedResponseError(self.network, e) - self._check_response_for_errors(response_text) - conn.close() + try: + self._check_response_for_errors(response_text) + finally: + conn.close() return response_text def execute(self, cacheable=False): diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..34667c8 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +filterwarnings = + once::DeprecationWarning + once::PendingDeprecationWarning