Merge pull request #9823 from tobiasdiez/patch-1
Clarify error message in case no collectors are found for a file
This commit is contained in:
commit
1e8e46d456
1
AUTHORS
1
AUTHORS
|
@ -326,6 +326,7 @@ Thomas Grainger
|
|||
Thomas Hisch
|
||||
Tim Hoffmann
|
||||
Tim Strazny
|
||||
Tobias Diez
|
||||
Tom Dalton
|
||||
Tom Viner
|
||||
Tomáš Gavenčiak
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Improved error message that is shown when no collector is found for a given file.
|
|
@ -645,9 +645,14 @@ class Session(nodes.FSCollector):
|
|||
self.trace.root.indent -= 1
|
||||
if self._notfound:
|
||||
errors = []
|
||||
for arg, cols in self._notfound:
|
||||
line = f"(no name {arg!r} in any of {cols!r})"
|
||||
errors.append(f"not found: {arg}\n{line}")
|
||||
for arg, collectors in self._notfound:
|
||||
if collectors:
|
||||
errors.append(
|
||||
f"not found: {arg}\n(no name {arg!r} in any of {collectors!r})"
|
||||
)
|
||||
else:
|
||||
errors.append(f"found no collectors for {arg}")
|
||||
|
||||
raise UsageError(*errors)
|
||||
if not genitems:
|
||||
items = rep.result
|
||||
|
|
|
@ -186,8 +186,7 @@ class TestGeneralUsage:
|
|||
assert result.ret == ExitCode.USAGE_ERROR
|
||||
result.stderr.fnmatch_lines(
|
||||
[
|
||||
f"ERROR: not found: {p2}",
|
||||
f"(no name {str(p2)!r} in any of [[][]])",
|
||||
f"ERROR: found no collectors for {p2}",
|
||||
"",
|
||||
]
|
||||
)
|
||||
|
|
|
@ -1855,8 +1855,7 @@ def test_config_blocked_default_plugins(pytester: Pytester, plugin: str) -> None
|
|||
assert result.ret == ExitCode.USAGE_ERROR
|
||||
result.stderr.fnmatch_lines(
|
||||
[
|
||||
"ERROR: not found: */test_config_blocked_default_plugins.py",
|
||||
"(no name '*/test_config_blocked_default_plugins.py' in any of [])",
|
||||
"ERROR: found no collectors for */test_config_blocked_default_plugins.py",
|
||||
]
|
||||
)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue