summaryrefslogtreecommitdiff
path: root/dev-python/tavern/files/tavern-2.10.1-pytest-8.patch
blob: 6820164b50e1e2e4531cd24caa2c122bc1d660f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 3aa8cc92e474e91c2a4014b4b4ec2f1e4b2e620a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
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):