From 89f2a849fd72000fb6dc7466fa93f22c5043b247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 11 May 2024 17:16:27 +0200 Subject: [PATCH] Replace deprecated `pytest.warns(None)` (#922) Replace the deprecated `pytest.warns(None)` with the standard library `warnings.catch_warnings(record=True)`, in order to fix compatibility with pytest-8.1.2. Co-authored-by: michaelboulton --- tests/unit/test_call_run.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_call_run.py b/tests/unit/test_call_run.py index 30972c1a..db169536 100644 --- a/tests/unit/test_call_run.py +++ b/tests/unit/test_call_run.py @@ -1,3 +1,4 @@ +import warnings from unittest.mock import patch import pytest @@ -35,7 +36,7 @@ def test_run_with_cfg(self): ) def test_doesnt_warn_about_expected_kwargs(self, expected_kwarg): kw = {expected_kwarg: 123} - with pytest.warns(None) as warn_rec: + with warnings.catch_warnings(record=True) as warn_rec: run("", **kw) assert not len(warn_rec)