ci: fix pytest.warns type error

use warnings.catch_warnings to suppress instead
https://docs.pytest.org/en/7.0.x/how-to/capture-warnings.html?highlight=warnings#additional-use-cases-of-warnings-in-tests

likely due to pytest update to version 7
This commit is contained in:
Dima Gerasimov 2022-02-04 22:40:11 +00:00 committed by karlicoss
parent c4ad84ad95
commit f78b12f005

View file

@ -161,7 +161,9 @@ def test_serialize_fallback() -> None:
# ignore warnings. depending on test order,
# the lru_cache'd warning may have already been sent,
# so checking may be nondeterministic?
with pytest.warns(None):
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
res = jsn.loads(dumps(X))
assert res == [5, 5.0]