summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-01-22 13:04:30 +0100
committerDaniel Hahler <git@thequod.de>2020-01-23 11:57:12 +0100
commit00097df5cdc383315e020039233cd8e7562aa316 (patch)
tree44b86212690a4f2f9f15012a852b055c53493756 /testing
parent10e243d206b47c01fe6b813ed07743e6c15c175f (diff)
downloadpytest-00097df5cdc383315e020039233cd8e7562aa316.tar.gz
tests: add test_plugin_loading_order
Ref: https://github.com/pytest-dev/pytest/pull/6443
Diffstat (limited to 'testing')
-rw-r--r--testing/test_config.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/test_config.py b/testing/test_config.py
index 498cbf7eb..cc54e5b23 100644
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -670,6 +670,32 @@ def test_disable_plugin_autoload(testdir, monkeypatch, parse_args, should_load):
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(
"""