Open akhilramkee opened 2 years ago
@nicoddemus , any views on this ?
Hey @akhilramkee, sorry for not answering earlier.
I think this is mostly an oversight, can't think of a reason not to apply the filters at that stage.
Thanks for replying in short notice! Would it be fine if I send in a PR to fix this?
Hey @akhilramkee - sorry about the long delay! PRs always welcome 🙂
Is there a reason why we don't apply any other warning filters passed in
pytest.ini
. This seems like a possible bug,https://github.com/pytest-dev/pytest/blob/c2b1d5b368a1fc829c6c06c700ae2ba9cda55794/src/_pytest/config/__init__.py#L1010
Output
Warning is thrown before test session starts
Reproducer
conftest.py
Content ->
pytest.ini
Warning gets filtered out in testcases as expected.
Possible fix:
warnings.simplefilter('default')
usingapply_warning_filters
https://github.com/pytest-dev/pytest/blob/e54c6a1362589b32a2e63bb780192b86216ecec8/src/_pytest/config/__init__.py#L1709