Skip to content

Commit

Permalink
tests: add test_plugin_loading_order
Browse files Browse the repository at this point in the history
Ref: pytest-dev#6443

Adjusted for pytest-dev#6443 being merged
here already.

(cherry picked from commit 05c8dc1)
  • Loading branch information
blueyed committed Jan 22, 2020
1 parent ef28edb commit c5f4d6b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions testing/test_config.py
Expand Up @@ -718,6 +718,32 @@ def distributions():
assert PseudoPlugin.attrs_used == []


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 == [False, 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 c5f4d6b

Please sign in to comment.