From 27734b2df03491f470fefc80d98d705fdb90fe5e Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Sun, 1 Sep 2024 20:58:02 +0200 Subject: [PATCH] Adjust test for Pytest 7+ Pytest7 deprecated usage of pytest.warns(None). See the following GitHub issues/PRs: * pytest-dev/pytest#8645 * pytest-dev/pytest#9404 Signed-off-by: Peter Lemenkov --- test/unit/test_client.py | 7 ++++--- tox.ini | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/unit/test_client.py b/test/unit/test_client.py index 190faf91..ab736294 100644 --- a/test/unit/test_client.py +++ b/test/unit/test_client.py @@ -1,14 +1,15 @@ import pytest +import warnings import ipfshttpclient def test_assert_version(): - with pytest.warns(None) as warnings: + with warnings.catch_warnings(): # Minimum required version ipfshttpclient.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"]) - assert len(warnings) == 0 + warnings.simplefilter("error") # Too high version with pytest.warns(ipfshttpclient.exceptions.VersionMismatch): @@ -41,4 +42,4 @@ def test_client_session_context(): assert client._client._session is None with client: assert client._client._session is not None - assert client._client._session is None \ No newline at end of file + assert client._client._session is None diff --git a/tox.ini b/tox.ini index 56584c6e..c1064928 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ isolated_build = true [testenv] deps = - pytest ~= 6.2 + pytest >= 7.0.0 pytest-cov ~= 2.11 pytest-dependency ~= 0.5 pytest-localserver ~= 0.5