Skip to content

tests: add test_plugin_loading_order #6534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,32 @@ def distributions():
assert has_loaded == should_load


def test_plugin_loading_order(testdir):
"""Test order of plugin loading with `-p`."""
p1 = testdir.makepyfile(
"""
def test_terminal_plugin(request):
import myplugin
assert myplugin.terminal_plugin == [True, True]
""",
**{
"myplugin": """
terminal_plugin = []

def pytest_configure(config):
terminal_plugin.append(bool(config.pluginmanager.get_plugin("terminalreporter")))

def pytest_sessionstart(session):
config = session.config
terminal_plugin.append(bool(config.pluginmanager.get_plugin("terminalreporter")))
"""
}
)
testdir.syspathinsert()
result = testdir.runpytest("-p", "myplugin", str(p1))
assert result.ret == 0


def test_cmdline_processargs_simple(testdir):
testdir.makeconftest(
"""
Expand Down