Skip to content

Commit b32d456

Browse files
committed
implement code review changes
1 parent 774c632 commit b32d456

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

changelog/11906.bugfix.rst

+1
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

+1
Original file line numberDiff line numberDiff line change
@@ -326,5 +326,6 @@ def found_str():
326326
category=w.category,
327327
filename=w.filename,
328328
lineno=w.lineno,
329+
module=w.__module__,
329330
source=w.source,
330331
)

testing/test_recwarn.py

+2
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ def test_catch_warning_within_raise(self) -> None:
479479
raise ValueError("some exception")
480480

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

0 commit comments

Comments
 (0)