MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_double_test

Method test_double_test

testing/test_recwarn.py:355–369  ·  view source on GitHub ↗

If a test is run again, the warning should still be raised

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

353 assert str(record[1].message) == "runtime"
354
355 def test_double_test(self, pytester: Pytester) -> None:
356 """If a test is run again, the warning should still be raised"""
357 pytester.makepyfile(
358 """
359 import pytest
360 import warnings
361
362 @pytest.mark.parametrize('run', [1, 2])
363 def test(run):
364 with pytest.warns(RuntimeWarning):
365 warnings.warn("runtime", RuntimeWarning)
366 """
367 )
368 result = pytester.runpytest()
369 result.stdout.fnmatch_lines(["*2 passed in*"])
370
371 def test_match_regex(self) -> None:
372 with pytest.warns(UserWarning, match=r"must be \d+$"):

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected