From 01a2f5495418ef1fa404cac2169e795dd81b244c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 14 Feb 2022 08:48:41 -0300 Subject: [PATCH] Update output text as per review --- src/_pytest/warnings.py | 4 +--- testing/test_warnings.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index 8fdacfcc1..4aaa94452 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -92,9 +92,7 @@ def warning_record_to_str(warning_message: warnings.WarningMessage) -> str: formatted_tb = "\n".join(tb.format()) # Use a leading new line to better separate the (large) output # from the traceback to the previous warning text. - msg += ( - f"\nObject allocated at (most recent call first):\n{formatted_tb}" - ) + msg += f"\nObject allocated at:\n{formatted_tb}" else: # No need for a leading new line. url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings" diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 4d3634991..8b841d638 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -819,7 +819,7 @@ def test_resource_warning(pytester: Pytester, monkeypatch: pytest.MonkeyPatch) - expected_extra = ( [ "*ResourceWarning* unclosed file*", - "*Object allocated at (most recent call first)*", + "*Object allocated at*", ] if has_tracemalloc else []