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

Method test_accessmarker_dynamic

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

Source from the content-addressed store, hash-verified

1149 reprec.assertoutcome(passed=1)
1150
1151 def test_accessmarker_dynamic(self, pytester: Pytester) -> None:
1152 pytester.makeconftest(
1153 """
1154 import pytest
1155 @pytest.fixture()
1156 def keywords(request):
1157 return request.keywords
1158
1159 @pytest.fixture(scope="class", autouse=True)
1160 def marking(request):
1161 request.applymarker(pytest.mark.XYZ("hello"))
1162 """
1163 )
1164 pytester.makepyfile(
1165 """
1166 import pytest
1167 def test_fun1(keywords):
1168 assert keywords["XYZ"] is not None
1169 assert "abc" not in keywords
1170 def test_fun2(keywords):
1171 assert keywords["XYZ"] is not None
1172 assert "abc" not in keywords
1173 """
1174 )
1175 reprec = pytester.inline_run()
1176 reprec.assertoutcome(passed=2)
1177
1178
1179class TestFixtureUsages:

Callers

nothing calls this directly

Calls 4

assertoutcomeMethod · 0.80
makeconftestMethod · 0.45
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected