From f78b12f0056481ac58913bf6faf9460c32b62883 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 4 Feb 2022 22:40:11 +0000 Subject: [PATCH] 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 --- my/core/serialize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/my/core/serialize.py b/my/core/serialize.py index 1a9d070..db65adb 100644 --- a/my/core/serialize.py +++ b/my/core/serialize.py @@ -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]