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

Function test_invocation_args

testing/test_config.py:2495–2520  ·  view source on GitHub ↗

Ensure that Config.invocation_* arguments are correctly defined

(pytester: Pytester)

Source from the content-addressed store, hash-verified

2493
2494
2495def test_invocation_args(pytester: Pytester) -> None:
2496 """Ensure that Config.invocation_* arguments are correctly defined"""
2497
2498 class DummyPlugin:
2499 pass
2500
2501 p = pytester.makepyfile("def test(): pass")
2502 plugin = DummyPlugin()
2503 rec = pytester.inline_run(p, "-v", plugins=[plugin])
2504 calls = rec.getcalls("pytest_runtest_protocol")
2505 assert len(calls) == 1
2506 call = calls[0]
2507 config = call.item.config
2508
2509 assert config.invocation_params.args == (str(p), "-v")
2510 assert config.invocation_params.dir == pytester.path
2511
2512 plugins = config.invocation_params.plugins
2513 assert len(plugins) == 2
2514 assert plugins[0] is plugin
2515 # Installed by pytester.inline_run().
2516 assert type(plugins[1]).__name__ == "PytesterHelperPlugin"
2517
2518 # args cannot be None
2519 with pytest.raises(TypeError):
2520 Config.InvocationParams(args=None, plugins=None, dir=Path()) # type: ignore[arg-type]
2521
2522
2523@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

DummyPluginClass · 0.85
getcallsMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected