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

Method test_applymarker

testing/python/fixtures.py:1110–1133  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1108
1109class TestRequestMarking:
1110 def test_applymarker(self, pytester: Pytester) -> None:
1111 item1, item2 = pytester.getitems(
1112 """
1113 import pytest
1114
1115 @pytest.fixture
1116 def something(request):
1117 pass
1118 class TestClass(object):
1119 def test_func1(self, something):
1120 pass
1121 def test_func2(self, something):
1122 pass
1123 """
1124 )
1125 req1 = fixtures.FixtureRequest(item1, _ispytest=True)
1126 assert "xfail" not in item1.keywords
1127 req1.applymarker(pytest.mark.xfail)
1128 assert "xfail" in item1.keywords
1129 assert "skipif" not in item1.keywords
1130 req1.applymarker(pytest.mark.skipif)
1131 assert "skipif" in item1.keywords
1132 with pytest.raises(ValueError):
1133 req1.applymarker(42) # type: ignore[arg-type]
1134
1135 def test_accesskeywords(self, pytester: Pytester) -> None:
1136 pytester.makepyfile(

Callers

nothing calls this directly

Calls 2

applymarkerMethod · 0.95
getitemsMethod · 0.45

Tested by

no test coverage detected