add conversion for test_warning_types.py also

This commit is contained in:
symonk 2020-10-25 17:38:12 +00:00
parent 7495d2c345
commit 6b7203aba7
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import inspect
import _pytest.warning_types import _pytest.warning_types
import pytest import pytest
from _pytest.pytester import Pytester
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -20,11 +21,11 @@ def test_warning_types(warning_class):
@pytest.mark.filterwarnings("error::pytest.PytestWarning") @pytest.mark.filterwarnings("error::pytest.PytestWarning")
def test_pytest_warnings_repr_integration_test(testdir): def test_pytest_warnings_repr_integration_test(pytester: Pytester):
"""Small integration test to ensure our small hack of setting the __module__ attribute """Small integration test to ensure our small hack of setting the __module__ attribute
of our warnings actually works (#5452). of our warnings actually works (#5452).
""" """
testdir.makepyfile( pytester.makepyfile(
""" """
import pytest import pytest
import warnings import warnings
@ -33,5 +34,5 @@ def test_pytest_warnings_repr_integration_test(testdir):
warnings.warn(pytest.PytestWarning("some warning")) warnings.warn(pytest.PytestWarning("some warning"))
""" """
) )
result = testdir.runpytest() result = pytester.runpytest()
result.stdout.fnmatch_lines(["E pytest.PytestWarning: some warning"]) result.stdout.fnmatch_lines(["E pytest.PytestWarning: some warning"])