warnings.warn_explicit() accepts its required message, category, filename, and lineno parameters by position or keyword, but test_warnings.WarnTests does not explicitly cover those keyword calls.
This is used by pytest's Node.warn():
import warnings
warnings.warn_explicit(
UserWarning("probe"), category=None, filename="probe.py", lineno=7
)
CPython already handles this correctly. A RustPython compatibility bug exposed the coverage gap, and a RustPython maintainer suggested adding CPython test coverage.
Add a test to the shared WarnTests class for positional, keyword, and mixed calls with both string messages and warning instances. This exercises the C and pure-Python implementations without changing runtime behavior.
AI assistance: Codex helped prepare the test and this report.
Linked PRs
warnings.warn_explicit()accepts its requiredmessage,category,filename, andlinenoparameters by position or keyword, buttest_warnings.WarnTestsdoes not explicitly cover those keyword calls.This is used by pytest's
Node.warn():CPython already handles this correctly. A RustPython compatibility bug exposed the coverage gap, and a RustPython maintainer suggested adding CPython test coverage.
Add a test to the shared
WarnTestsclass for positional, keyword, and mixed calls with both string messages and warning instances. This exercises the C and pure-Python implementations without changing runtime behavior.AI assistance: Codex helped prepare the test and this report.
Linked PRs