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
|
Thomas Hisch
|
||||||
Tim Hoffmann
|
Tim Hoffmann
|
||||||
Tim Strazny
|
Tim Strazny
|
||||||
|
Tobias Diez
|
||||||
Tom Dalton
|
Tom Dalton
|
||||||
Tom Viner
|
Tom Viner
|
||||||
Tomáš Gavenčiak
|
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
|
self.trace.root.indent -= 1
|
||||||
if self._notfound:
|
if self._notfound:
|
||||||
errors = []
|
errors = []
|
||||||
for arg, cols in self._notfound:
|
for arg, collectors in self._notfound:
|
||||||
line = f"(no name {arg!r} in any of {cols!r})"
|
if collectors:
|
||||||
errors.append(f"not found: {arg}\n{line}")
|
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)
|
raise UsageError(*errors)
|
||||||
if not genitems:
|
if not genitems:
|
||||||
items = rep.result
|
items = rep.result
|
||||||
|
|
|
@ -186,8 +186,7 @@ class TestGeneralUsage:
|
||||||
assert result.ret == ExitCode.USAGE_ERROR
|
assert result.ret == ExitCode.USAGE_ERROR
|
||||||
result.stderr.fnmatch_lines(
|
result.stderr.fnmatch_lines(
|
||||||
[
|
[
|
||||||
f"ERROR: not found: {p2}",
|
f"ERROR: found no collectors for {p2}",
|
||||||
f"(no name {str(p2)!r} in any of [[][]])",
|
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1855,8 +1855,7 @@ def test_config_blocked_default_plugins(pytester: Pytester, plugin: str) -> None
|
||||||
assert result.ret == ExitCode.USAGE_ERROR
|
assert result.ret == ExitCode.USAGE_ERROR
|
||||||
result.stderr.fnmatch_lines(
|
result.stderr.fnmatch_lines(
|
||||||
[
|
[
|
||||||
"ERROR: not found: */test_config_blocked_default_plugins.py",
|
"ERROR: found no collectors for */test_config_blocked_default_plugins.py",
|
||||||
"(no name '*/test_config_blocked_default_plugins.py' in any of [])",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue