Skip to content

Commit 60469ee

Browse files
committed
fix/adjust test_disable_plugin_autoload
1 parent 0652304 commit 60469ee

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

testing/test_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,13 @@ class Distribution:
665665
class PseudoPlugin:
666666
x = 42
667667

668+
attrs_used = []
669+
670+
def __getattr__(self, name):
671+
assert name == "__loader__"
672+
self.attrs_used.append(name)
673+
return object()
674+
668675
def distributions():
669676
return (Distribution(),)
670677

@@ -674,6 +681,10 @@ def distributions():
674681
config = testdir.parseconfig(*parse_args)
675682
has_loaded = config.pluginmanager.get_plugin("mytestplugin") is not None
676683
assert has_loaded == should_load
684+
if should_load:
685+
assert PseudoPlugin.attrs_used == ["__loader__"]
686+
else:
687+
assert PseudoPlugin.attrs_used == []
677688

678689

679690
def test_cmdline_processargs_simple(testdir):

0 commit comments

Comments
 (0)