Skip to content

Commit 6c5008e

Browse files
committed
implement code review changes
1 parent 088f83f commit 6c5008e

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

changelog/11906.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix regression with :func:`pytest.warns` using custom warning subclasses which have more than one parameter in their `__init__`.

src/_pytest/recwarn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ def found_str():
326326
category=w.category,
327327
filename=w.filename,
328328
lineno=w.lineno,
329+
module=w.__module__,
329330
source=w.source,
330331
)
331332
# Check warnings has valid argument type (#10865).

testing/test_recwarn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ def test_catch_warning_within_raise(self) -> None:
480480
raise ValueError("some exception")
481481

482482
def test_multiple_arg_custom_warning(self) -> None:
483+
"""Test for issue #11906."""
484+
483485
class CustomWarning(UserWarning):
484486
def __init__(self, a, b):
485487
pass

0 commit comments

Comments
 (0)