Update output text as per review

This commit is contained in:
Bruno Oliveira 2022-02-14 08:48:41 -03:00
parent cdd827be5c
commit 01a2f54954
2 changed files with 2 additions and 4 deletions

View File

@ -92,9 +92,7 @@ def warning_record_to_str(warning_message: warnings.WarningMessage) -> str:
formatted_tb = "\n".join(tb.format()) formatted_tb = "\n".join(tb.format())
# Use a leading new line to better separate the (large) output # Use a leading new line to better separate the (large) output
# from the traceback to the previous warning text. # from the traceback to the previous warning text.
msg += ( msg += f"\nObject allocated at:\n{formatted_tb}"
f"\nObject allocated at (most recent call first):\n{formatted_tb}"
)
else: else:
# No need for a leading new line. # No need for a leading new line.
url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings" url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings"

View File

@ -819,7 +819,7 @@ def test_resource_warning(pytester: Pytester, monkeypatch: pytest.MonkeyPatch) -
expected_extra = ( expected_extra = (
[ [
"*ResourceWarning* unclosed file*", "*ResourceWarning* unclosed file*",
"*Object allocated at (most recent call first)*", "*Object allocated at*",
] ]
if has_tracemalloc if has_tracemalloc
else [] else []