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

Method test_skipif_reporting_multiple

testing/test_skipping.py:930–948  ·  view source on GitHub ↗
(
        self, pytester: Pytester, marker, msg1, msg2
    )

Source from the content-addressed store, hash-verified

928 [("skipif", "SKIP", "skipped"), ("xfail", "XPASS", "xpassed")],
929 )
930 def test_skipif_reporting_multiple(
931 self, pytester: Pytester, marker, msg1, msg2
932 ) -> None:
933 pytester.makepyfile(
934 test_foo="""
935 import pytest
936 @pytest.mark.{marker}(False, reason='first_condition')
937 @pytest.mark.{marker}(True, reason='second_condition')
938 def test_foobar():
939 assert 1
940 """.format(
941 marker=marker
942 )
943 )
944 result = pytester.runpytest("-s", "-rsxX")
945 result.stdout.fnmatch_lines(
946 [f"*{msg1}*test_foo.py*second_condition*", f"*1 {msg2}*"]
947 )
948 assert result.ret == 0
949
950
951def test_skip_not_report_default(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
formatMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected