MCPcopy
hub / github.com/pytest-dev/pytest / test_skipped_reasons_functional

Function test_skipped_reasons_functional

testing/test_skipping.py:982–1017  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

980
981
982def test_skipped_reasons_functional(pytester: Pytester) -> None:
983 pytester.makepyfile(
984 test_one="""
985 import pytest
986 from helpers import doskip
987
988 def setup_function(func): # LINE 4
989 doskip("setup function")
990
991 def test_func():
992 pass
993
994 class TestClass:
995 def test_method(self):
996 doskip("test method")
997
998 @pytest.mark.skip("via_decorator") # LINE 14
999 def test_deco(self):
1000 assert 0
1001 """,
1002 helpers="""
1003 import pytest, sys
1004 def doskip(reason):
1005 assert sys._getframe().f_lineno == 3
1006 pytest.skip(reason) # LINE 4
1007 """,
1008 )
1009 result = pytester.runpytest("-rs")
1010 result.stdout.fnmatch_lines_random(
1011 [
1012 "SKIPPED [[]1[]] test_one.py:7: setup function",
1013 "SKIPPED [[]1[]] helpers.py:4: test method",
1014 "SKIPPED [[]1[]] test_one.py:14: via_decorator",
1015 ]
1016 )
1017 assert result.ret == 0
1018
1019
1020def test_skipped_folding(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_lines_randomMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected