(pytester: Pytester)
| 980 | |
| 981 | |
| 982 | def 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 | |
| 1020 | def test_skipped_folding(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected