Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ran Benita <[email protected]>
  • Loading branch information
graingert and bluetech authored Nov 28, 2024
1 parent 5cbe547 commit 2741b18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/_pytest/unraisableexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


def gc_collect_harder() -> None:
# A single collection doesn't necessarily collect everything.
# Constant determined experimentally by the Trio project.
for _ in range(5):
gc.collect()
Expand Down Expand Up @@ -114,7 +115,7 @@ def unraisable_hook(
)
tracemalloc_tb = tracemalloc_message(unraisable.object)
msg = summary + traceback_message + tracemalloc_tb
cause_msg = summary + tracemalloc_tb
cause_msg = summary + "\n" + tracemalloc_tb

Check warning on line 118 in src/_pytest/unraisableexception.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/unraisableexception.py#L116-L118

Added lines #L116 - L118 were not covered by tests

append(

Check warning on line 120 in src/_pytest/unraisableexception.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/unraisableexception.py#L120

Added line #L120 was not covered by tests
UnraisableMeta(
Expand Down
3 changes: 3 additions & 0 deletions testing/test_unraisableexception.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_2(): pass
" ",
" Traceback (most recent call last):",
" ValueError: del is broken",
" ",
" Enable tracemalloc to get traceback where the object was allocated.",
" See https* for more info.",
" warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))",
Expand Down Expand Up @@ -76,6 +77,7 @@ def test_2(): pass
" ",
" Traceback (most recent call last):",
" ValueError: del is broken",
" ",
" Enable tracemalloc to get traceback where the object was allocated.",
" See https* for more info.",
" warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))",
Expand Down Expand Up @@ -115,6 +117,7 @@ def test_2(): pass
" ",
" Traceback (most recent call last):",
" ValueError: del is broken",
" ",
" Enable tracemalloc to get traceback where the object was allocated.",
" See https* for more info.",
" warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))",
Expand Down

0 comments on commit 2741b18

Please sign in to comment.