(pytester: Pytester)
| 983 | |
| 984 | |
| 985 | def 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 | |
| 1022 | def test_skipped_folding(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected