From 687cdeb451f778b26fe8657b2476f3c07169c2dc Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 11 Jan 2020 22:52:42 +0100 Subject: [PATCH] fix/adjust test_disable_plugin_autoload --- testing/test_config.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testing/test_config.py b/testing/test_config.py index 9735fc17696..50cc7c73038 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -665,6 +665,13 @@ class Distribution: class PseudoPlugin: x = 42 + attrs_used = [] + + def __getattr__(self, name): + assert name == "__loader__" + self.attrs_used.append(name) + return object() + def distributions(): return (Distribution(),) @@ -674,6 +681,10 @@ def distributions(): config = testdir.parseconfig(*parse_args) has_loaded = config.pluginmanager.get_plugin("mytestplugin") is not None assert has_loaded == should_load + if should_load: + assert PseudoPlugin.attrs_used == ["__loader__"] + else: + assert PseudoPlugin.attrs_used == [] def test_cmdline_processargs_simple(testdir):