Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/3563.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warnings without ``location`` were reported as ``None``. This is corrected to now report ``<undetermined location>``.
2 changes: 1 addition & 1 deletion src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def summary_warnings(self):

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)
Expand Down
5 changes: 4 additions & 1 deletion testing/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,10 @@ def pytest_terminal_summary(terminalreporter):
"""
)
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(
Expand Down