Skip to content

Commit e6934d4

Browse files
committed
Fix test_early_load_setuptools_name to not crash pluggy
Closes #278.
1 parent 266a6b7 commit e6934d4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

testing/acceptance_test.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,36 @@ def load(self):
133133
@attr.s
134134
class DummyDist:
135135
entry_points = attr.ib()
136+
metadata = {"name": "mpyproject"}
136137
files = ()
137138

138139
def my_dists():
139140
return (DummyDist(entry_points),)
140141

141142
monkeypatch.setattr(importlib_metadata, "distributions", my_dists)
142143
params = ("-p", "mycov") if load_cov_early else ()
143-
testdir.runpytest_inprocess(*params)
144+
result = testdir.runpytest("--version", *params)
144145
if load_cov_early:
145146
assert loaded == ["mycov", "myplugin1", "myplugin2"]
147+
result.stderr.fnmatch_lines(
148+
[
149+
"setuptools registered plugins:",
150+
" mpyproject-None at */mycov_module.py",
151+
" mpyproject-None at */mytestplugin1_module.py",
152+
" mpyproject-None at */mytestplugin2_module.py",
153+
]
154+
)
146155
else:
147156
assert loaded == ["myplugin1", "myplugin2", "mycov"]
157+
result.stderr.fnmatch_lines(
158+
[
159+
"setuptools registered plugins:",
160+
" mpyproject-None at */mytestplugin1_module.py",
161+
" mpyproject-None at */mytestplugin2_module.py",
162+
" mpyproject-None at */mycov_module.py",
163+
]
164+
)
165+
assert result.ret == 0
148166

149167
def test_assertion_magic(self, testdir):
150168
p = testdir.makepyfile(

0 commit comments

Comments
 (0)