Ensure that Config.invocation_* arguments are correctly defined
(pytester: Pytester)
| 2493 | |
| 2494 | |
| 2495 | def 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( |
nothing calls this directly
no test coverage detected