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

Function test_mark_option_custom

testing/test_mark.py:304–327  ·  view source on GitHub ↗
(
    expr: str, expected_passed: list[str], pytester: Pytester
)

Source from the content-addressed store, hash-verified

302 [("interface", ["test_interface"]), ("not interface", ["test_nointer"])],
303)
304def test_mark_option_custom(
305 expr: str, expected_passed: list[str], pytester: Pytester
306) -> None:
307 pytester.makeconftest(
308 """
309 import pytest
310 def pytest_collection_modifyitems(items):
311 for item in items:
312 if "interface" in item.nodeid:
313 item.add_marker(pytest.mark.interface)
314 """
315 )
316 pytester.makepyfile(
317 """
318 def test_interface():
319 pass
320 def test_nointer():
321 pass
322 """
323 )
324 rec = pytester.inline_run("-m", expr)
325 passed, _skipped, _fail = rec.listoutcomes()
326 passed_str = [x.nodeid.split("::")[-1] for x in passed]
327 assert passed_str == expected_passed
328
329
330@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

listoutcomesMethod · 0.80
makeconftestMethod · 0.45
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected