Ensure that Config.invocation_* arguments are correctly defined
(pytester: Pytester)
| 1793 | |
| 1794 | |
| 1795 | def test_invocation_args(pytester: Pytester) -> None: |
| 1796 | """Ensure that Config.invocation_* arguments are correctly defined""" |
| 1797 | |
| 1798 | class DummyPlugin: |
| 1799 | pass |
| 1800 | |
| 1801 | p = pytester.makepyfile("def test(): pass") |
| 1802 | plugin = DummyPlugin() |
| 1803 | rec = pytester.inline_run(p, "-v", plugins=[plugin]) |
| 1804 | calls = rec.getcalls("pytest_runtest_protocol") |
| 1805 | assert len(calls) == 1 |
| 1806 | call = calls[0] |
| 1807 | config = call.item.config |
| 1808 | |
| 1809 | assert config.invocation_params.args == (str(p), "-v") |
| 1810 | assert config.invocation_params.dir == pytester.path |
| 1811 | |
| 1812 | plugins = config.invocation_params.plugins |
| 1813 | assert len(plugins) == 2 |
| 1814 | assert plugins[0] is plugin |
| 1815 | assert type(plugins[1]).__name__ == "Collect" # installed by pytester.inline_run() |
| 1816 | |
| 1817 | # args cannot be None |
| 1818 | with pytest.raises(TypeError): |
| 1819 | Config.InvocationParams(args=None, plugins=None, dir=Path()) # type: ignore[arg-type] |
| 1820 | |
| 1821 | |
| 1822 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected