Merge pull request #3563 from asottile/undetermined_location_none
Print <undetermined location> instead of None for warnings
This commit is contained in:
commit
11705040ac
|
@ -0,0 +1 @@
|
|||
Warnings without ``location`` were reported as ``None``. This is corrected to now report ``<undetermined location>``.
|
|
@ -682,7 +682,7 @@ class TerminalReporter(object):
|
|||
|
||||
self.write_sep("=", "warnings summary", yellow=True, bold=False)
|
||||
for location, warning_records in grouped:
|
||||
self._tw.line(str(location) or "<undetermined location>")
|
||||
self._tw.line(str(location) if location else "<undetermined location>")
|
||||
for w in warning_records:
|
||||
lines = w.message.splitlines()
|
||||
indented = "\n".join(" " + x for x in lines)
|
||||
|
|
|
@ -1025,7 +1025,10 @@ def test_terminal_summary_warnings_are_displayed(testdir):
|
|||
"""
|
||||
)
|
||||
result = testdir.runpytest("-rw")
|
||||
result.stdout.fnmatch_lines(["*internal warning", "*== 1 warnings in *"])
|
||||
result.stdout.fnmatch_lines(
|
||||
["<undetermined location>", "*internal warning", "*== 1 warnings in *"]
|
||||
)
|
||||
assert "None" not in result.stdout.str()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
Loading…
Reference in New Issue