From 3127ec737b107466654680ad785863b7c044d0da Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 24 Mar 2019 11:04:05 +0100 Subject: [PATCH] Fix pytest's own tests with `-W error::ResourceWarning` --- testing/python/fixture.py | 1 + testing/test_session.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 53df1990b..64f9a97c1 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1103,6 +1103,7 @@ class TestFixtureUsages(object): values = reprec.getfailedcollections() assert len(values) == 1 + @pytest.mark.filterwarnings("ignore::pytest.PytestDeprecationWarning") def test_request_can_be_overridden(self, testdir): testdir.makepyfile( """ diff --git a/testing/test_session.py b/testing/test_session.py index 6b185f76b..6f01bd3bf 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -116,7 +116,8 @@ class SessionTests(object): class TestBrokenClass(object): def test_explicit_bad_repr(self): t = BrokenRepr1() - pytest.raises(Exception, 'repr(t)') + with pytest.raises(Exception, match="I'm a broken repr"): + repr(t) def test_implicit_bad_repr1(self): t = BrokenRepr1()