Skip to content

Commit bcdb86e

Browse files
authored
Merge pull request #4991 from blueyed/fix-tests
Fix pytest's own tests with `-W error::ResourceWarning`
2 parents 3bc9cbe + 3127ec7 commit bcdb86e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

testing/python/fixture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ def __init__(self, request):
11031103
values = reprec.getfailedcollections()
11041104
assert len(values) == 1
11051105

1106+
@pytest.mark.filterwarnings("ignore::pytest.PytestDeprecationWarning")
11061107
def test_request_can_be_overridden(self, testdir):
11071108
testdir.makepyfile(
11081109
"""

testing/test_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def __repr__(self):
116116
class TestBrokenClass(object):
117117
def test_explicit_bad_repr(self):
118118
t = BrokenRepr1()
119-
pytest.raises(Exception, 'repr(t)')
119+
with pytest.raises(Exception, match="I'm a broken repr"):
120+
repr(t)
120121
121122
def test_implicit_bad_repr1(self):
122123
t = BrokenRepr1()

0 commit comments

Comments
 (0)