From c929b5bd8f1f0f4dca3994abefca2e7683bc85c4 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 11 Apr 2018 00:19:24 +0300 Subject: [PATCH 1/3] Show deprecation warnings for tests --- pytest.ini | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pytest.ini 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 From 85efc31c1044ffab820e51133196d9c99310b37c Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 10:38:00 +0300 Subject: [PATCH 2/3] Close HTTPSConnection in case of exception --- pylast/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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): From 887a47c51599e176026212db365815e02914c2dd Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 11:25:42 +0300 Subject: [PATCH 3/3] Ignore new '.pytest_cache' directory --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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