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

Function test_plugin_loading_order

testing/test_config.py:1104–1127  ·  view source on GitHub ↗

Test order of plugin loading with `-p`.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

1102
1103
1104def test_plugin_loading_order(pytester: Pytester) -> None:
1105 """Test order of plugin loading with `-p`."""
1106 p1 = pytester.makepyfile(
1107 """
1108 def test_terminal_plugin(request):
1109 import myplugin
1110 assert myplugin.terminal_plugin == [False, True]
1111 """,
1112 **{
1113 "myplugin": """
1114 terminal_plugin = []
1115
1116 def pytest_configure(config):
1117 terminal_plugin.append(bool(config.pluginmanager.get_plugin("terminalreporter")))
1118
1119 def pytest_sessionstart(session):
1120 config = session.config
1121 terminal_plugin.append(bool(config.pluginmanager.get_plugin("terminalreporter")))
1122 """
1123 },
1124 )
1125 pytester.syspathinsert()
1126 result = pytester.runpytest("-p", "myplugin", str(p1))
1127 assert result.ret == 0
1128
1129
1130def test_cmdline_processargs_simple(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

makepyfileMethod · 0.45
syspathinsertMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected