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

Method test_skipif_conditional

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

Source from the content-addressed store, hash-verified

884
885class TestSkipif:
886 def test_skipif_conditional(self, pytester: Pytester) -> None:
887 item = pytester.getitem(
888 """
889 import pytest
890 @pytest.mark.skipif("hasattr(os, 'sep')")
891 def test_func():
892 pass
893 """
894 )
895 x = pytest.raises(pytest.skip.Exception, lambda: pytest_runtest_setup(item))
896 assert x.value.msg == "condition: hasattr(os, 'sep')"
897
898 @pytest.mark.parametrize(
899 "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