Skip to content

Commit 27734b2

Browse files
committed
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 <[email protected]>
1 parent acac2b5 commit 27734b2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

test/unit/test_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import pytest
2+
import warnings
23

34
import ipfshttpclient
45

56

67
def test_assert_version():
7-
with pytest.warns(None) as warnings:
8+
with warnings.catch_warnings():
89
# Minimum required version
910
ipfshttpclient.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"])
1011

11-
assert len(warnings) == 0
12+
warnings.simplefilter("error")
1213

1314
# Too high version
1415
with pytest.warns(ipfshttpclient.exceptions.VersionMismatch):
@@ -41,4 +42,4 @@ def test_client_session_context():
4142
assert client._client._session is None
4243
with client:
4344
assert client._client._session is not None
44-
assert client._client._session is None
45+
assert client._client._session is None

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ isolated_build = true
1313

1414
[testenv]
1515
deps =
16-
pytest ~= 6.2
16+
pytest >= 7.0.0
1717
pytest-cov ~= 2.11
1818
pytest-dependency ~= 0.5
1919
pytest-localserver ~= 0.5

0 commit comments

Comments
 (0)