We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9cc6b50 commit ff23a49Copy full SHA for ff23a49
src/_pytest/recwarn.py
@@ -5,6 +5,7 @@
5
6
from pprint import pformat
7
import re
8
+import sys
9
from types import TracebackType
10
from typing import Any
11
from typing import Callable
@@ -327,12 +328,17 @@ def found_str() -> str:
327
328
# Whether or not any warnings matched, we want to re-emit all unmatched warnings.
329
for w in self:
330
if not self.matches(w):
331
+ module = next(
332
+ k
333
+ for k, v in sys.modules.items()
334
+ if getattr(v, "__file__", None) == w.filename
335
+ )
336
warnings.warn_explicit(
337
message=w.message,
338
category=w.category,
339
filename=w.filename,
340
lineno=w.lineno,
- module=w.__module__,
341
+ module=module,
342
source=w.source,
343
)
344
0 commit comments