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

Function test_skipped_reasons_functional

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

Source from the content-addressed store, hash-verified

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