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

Method test_skipif_conditional

testing/test_skipping.py:885–895  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

883
884class TestSkipif:
885 def test_skipif_conditional(self, pytester: Pytester) -> None:
886 item = pytester.getitem(
887 """
888 import pytest
889 @pytest.mark.skipif("hasattr(os, 'sep')")
890 def test_func():
891 pass
892 """
893 )
894 x = pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item))
895 assert x.value.msg == "condition: hasattr(os, 'sep')"
896
897 @pytest.mark.parametrize(
898 "params", ["\"hasattr(sys, 'platform')\"", 'True, reason="invalid platform"']

Callers

nothing calls this directly

Calls 2

pytest_runtest_setupFunction · 0.90
getitemMethod · 0.45

Tested by

no test coverage detected