Added test for Issue 4617

This commit is contained in:
Victor Maryama 2019-01-09 12:31:26 +01:00
parent a4c426b1a8
commit 948a5d5ac6
1 changed files with 24 additions and 0 deletions

View File

@ -683,3 +683,27 @@ class TestAssertionWarnings:
self.create_file(testdir, False)
result = testdir.runpytest()
result.stdout.fnmatch_lines(["*1 failed in*"])
def test_warningschecker_twice(testdir):
"""Issue #4617"""
testdir.makepyfile(
"""
import pytest
import warnings
@pytest.mark.parametrize("other", [1, 2])
@pytest.mark.parametrize("expectation", [
pytest.warns(DeprecationWarning,
match="Message A"),
pytest.warns(DeprecationWarning,
match="Message A"),
])
def test_parametrized_warnings(other, expectation):
with expectation:
warnings.warn("Message A", DeprecationWarning)
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines(["* 4 passed in *"])