From 3aa8cc92e474e91c2a4014b4b4ec2f1e4b2e620a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 28 Mar 2024 13:20:00 +0100 Subject: [PATCH] Replace deprecated `pytest.warns(None)` Replace the deprecated `pytest.warns(None)` use with the `error` warning filter, as recommended in https://github.com/pytest-dev/pytest/issues/9404#issue-1076710891. With this change, the tests pass with pytest-8.1.1. --- tests/unit/test_call_run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_call_run.py b/tests/unit/test_call_run.py index 30972c1a..88a72714 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,11 +36,10 @@ 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(): + warnings.simplefilter("error") run("", **kw) - assert not len(warn_rec) - class TestParseGlobalCfg: def test_path_correct(self):