Skip to content

Commit

Permalink
tests: add test_plugin_loading_order
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jan 22, 2020
1 parent 0f78ef8 commit 05c8dc1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions testing/test_config.py
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

0 comments on commit 05c8dc1

Please sign in to comment.