Skip to content

Commit

Permalink
implement code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
reaganjlee committed Feb 8, 2024
1 parent 088f83f commit 6c5008e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/11906.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression with :func:`pytest.warns` using custom warning subclasses which have more than one parameter in their `__init__`.
1 change: 1 addition & 0 deletions src/_pytest/recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def found_str():
category=w.category,
filename=w.filename,
lineno=w.lineno,
module=w.__module__,
source=w.source,
)
# Check warnings has valid argument type (#10865).
Expand Down
2 changes: 2 additions & 0 deletions testing/test_recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ def test_catch_warning_within_raise(self) -> None:
raise ValueError("some exception")

def test_multiple_arg_custom_warning(self) -> None:
"""Test for issue #11906."""

class CustomWarning(UserWarning):
def __init__(self, a, b):
pass
Expand Down

0 comments on commit 6c5008e

Please sign in to comment.