I am getting MatplotlibDeprecationWarning that causes an error with test_warn failed when I run this test with the PythonDebugger in the Testing extension.
Setting a breakpoint in the line of with pytest.warns(UserWarning, match="Test"): and run in debug-mode. The debugger raises an error:
Diagnostic data
Traceback:
/home/stefanie/code/scikit-learn_dev/scikit-learn/sklearn/test_warn.py::test_warn failed: def test_warn():
> with pytest.warns(UserWarning, match="Test"):
sklearn/test_warn.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<stringsource>:69: in cfunc.to_py.__Pyx_CFunc_b0409f__29_pydevd_sys_monitoring_cython_object__lParen__etc_to_py_4code_4line.wrap
???
_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx:1429: in _pydevd_sys_monitoring_cython._line_event
???
_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx:1471: in _pydevd_sys_monitoring_cython._internal_line_event
???
_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx:1278: in _pydevd_sys_monitoring_cython._stop_on_breakpoint
???
_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx:1906: in _pydevd_sys_monitoring_cython._do_wait_suspend
???
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py:2197: in do_wait_suspend
keep_suspended = self._do_wait_suspend(thread, frame, event, arg, trace_suspend_type, from_this_thread, frames_tracker)
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py:2223: in _do_wait_suspend
self._activate_gui_if_needed()
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py:1685: in _activate_gui_if_needed
activate_function()
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd.py:1668: in <lambda>
"matplotlib": lambda: activate_matplotlib(do_enable_gui),
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py:99: in activate_matplotlib
is_interactive = is_interactive_backend(backend)
../../../.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py:59: in is_interactive_backend
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport
../../../.pyenv/versions/3.12.2/envs/scikit-learn_dev/lib/python3.12/site-packages/matplotlib/_api/__init__.py:216: in __getattr__
return props[name].__get__(instance)
../../../.pyenv/versions/3.12.2/envs/scikit-learn_dev/lib/python3.12/site-packages/matplotlib/_api/deprecation.py:161: in __get__
emit_warning()
../../../.pyenv/versions/3.12.2/envs/scikit-learn_dev/lib/python3.12/site-packages/matplotlib/_api/deprecation.py:196: in emit_warning
warn_deprecated(
../../../.pyenv/versions/3.12.2/envs/scikit-learn_dev/lib/python3.12/site-packages/matplotlib/_api/deprecation.py:99: in warn_deprecated
warn_external(warning, category=MatplotlibDeprecationWarning)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
message = MatplotlibDeprecationWarning('The interactive_bk attribute was deprecated in Matplotlib 3.9 and will be removed in 3.11. Use ``matplotlib.backends.backend_registry.list_builtin(matplotlib.backends.BackendFilter.INTERACTIVE)`` instead.')
category = <class 'matplotlib._api.deprecation.MatplotlibDeprecationWarning'>
def warn_external(message, category=None):
"""
`warnings.warn` wrapper that sets *stacklevel* to "outside Matplotlib".
The original emitter of the warning can be obtained by patching this
function back to `warnings.warn`, i.e. ``_api.warn_external =
warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
etc.).
"""
frame = sys._getframe()
for stacklevel in itertools.count(1):
if frame is None:
# when called in embedded context may hit frame is None
break
if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))",
# Work around sphinx-gallery not setting __name__.
frame.f_globals.get("__name__", "")):
break
frame = frame.f_back
# preemptively break reference cycle between locals and the frame
del frame
> warnings.warn(message, category, stacklevel)
E matplotlib._api.deprecation.MatplotlibDeprecationWarning: The interactive_bk attribute was deprecated in Matplotlib 3.9 and will be removed in 3.11. Use ``matplotlib.backends.backend_registry.list_builtin(matplotlib.backends.BackendFilter.INTERACTIVE)`` instead.
../../../.pyenv/versions/3.12.2/envs/scikit-learn_dev/lib/python3.12/site-packages/matplotlib/_api/__init__.py:381: MatplotlibDeprecationWarning
I would have expected not to see this warning and be able to continue with the debugging.
Running the test with Testing without debug points or running the tests with pytest on the terminal works just fine.
Extension version: 2024.12.0
VS Code version: Code 1.95.2 (e8653663e8840adaf45af01eab5c627a5af81807, 2024-11-07T11:07:22.054Z)
OS version: Linux x64 6.11.5-arch1-1
Modes:
Python version (& distribution if applicable, e.g. Anaconda): 3.12.2
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): VirtualEnvironmentSystem Info
Type: Bug
Behaviour
I am getting
MatplotlibDeprecationWarning
that causes an error withtest_warn failed
when I run this test with thePythonDebugger
in theTesting
extension.versions: pytest==8.3.1 matplotlib==3.9.2
Steps to reproduce:
Setting a breakpoint in the line of
with pytest.warns(UserWarning, match="Test"):
and run in debug-mode. The debugger raises an error:Diagnostic data
Traceback:
I would have expected not to see this warning and be able to continue with the debugging.
Running the test with Testing without debug points or running the tests with pytest on the terminal works just fine.
Extension version: 2024.12.0 VS Code version: Code 1.95.2 (e8653663e8840adaf45af01eab5c627a5af81807, 2024-11-07T11:07:22.054Z) OS version: Linux x64 6.11.5-arch1-1 Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off