-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Closed
Description
A number of deprecation warnings were introduced with #10850 that can not be suppressed by pytest's warnings-capture options and will clutter the output.
I ran into the issue because sklearn still uses the deprecated functions, so I can't fix the issue in my own code. My repro-example will feature sklearn, but it shouldn't be necessary to isolate the issue.
Reproducing code example:
environment: python3.7.0, numpy==1.15.1, pytest==3.7.4, scikit-learn==0.19.2, scipy==1.1.0
Files: test.py
def test_umath_tests_warning():
from sklearn.ensemble import weight_boosting # <-- imports numpy.core.umath_tests
Run from command line:
$ python -m pytest test.py
Error message:
=============================== warnings summary ===============================
test.py::test_umath_tests_warning
/home/user/env/lib/python3.7/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
from numpy.core.umath_tests import inner1d
-- Docs: https://docs.pytest.org/en/latest/warnings.html
===================== 1 passed, 1 warnings in 0.33 seconds =====================
Possible fix:
Changing the stacklevel of all warnings from #10850 to 1 (i.e. the default value) solves the problem on my end.
Metadata
Metadata
Assignees
Labels
No labels