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

Function test_mark_option_custom

testing/test_mark.py:239–262  ·  view source on GitHub ↗
(
    expr: str, expected_passed: List[str], pytester: Pytester
)

Source from the content-addressed store, hash-verified

237 [("interface", ["test_interface"]), ("not interface", ["test_nointer"])],
238)
239def test_mark_option_custom(
240 expr: str, expected_passed: List[str], pytester: Pytester
241) -> None:
242 pytester.makeconftest(
243 """
244 import pytest
245 def pytest_collection_modifyitems(items):
246 for item in items:
247 if "interface" in item.nodeid:
248 item.add_marker(pytest.mark.interface)
249 """
250 )
251 pytester.makepyfile(
252 """
253 def test_interface():
254 pass
255 def test_nointer():
256 pass
257 """
258 )
259 rec = pytester.inline_run("-m", expr)
260 passed, skipped, fail = rec.listoutcomes()
261 passed_str = [x.nodeid.split("::")[-1] for x in passed]
262 assert passed_str == expected_passed
263
264
265@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