Skip to content
Permalink
Browse files

Merge pull request #3563 from asottile/undetermined_location_none

Print <undetermined location> instead of None for warnings
  • Loading branch information...
nicoddemus committed Jun 10, 2018
2 parents fe81de6 + 49f621d commit 11705040ac4961dadb865884285e9920c91c3ca1
Showing with 6 additions and 2 deletions.
  1. +1 −0 changelog/3563.bugfix.rst
  2. +1 −1 src/_pytest/terminal.py
  3. +4 −1 testing/test_terminal.py
@@ -0,0 +1 @@
Warnings without ``location`` were reported as ``None``. This is corrected to now report ``<undetermined location>``.
@@ -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)
@@ -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(

0 comments on commit 1170504

Please sign in to comment.
You can’t perform that action at this time.