Skip to content

2 Matplotlib related test failures #710

Description

@doronbehar

Hello,

While trying to distribute this to NixOS, I encountered these test failures:

=================================== FAILURES ===================================
_________________________ test_mask_2d_with_rectangles _________________________
[gw7] linux -- Python 3.13.13 /nix/store/60m4rxhg2fldqaak400c0lry96ijrzqn-python3-3.13.13/bin/python3.13

    @pytest.mark.usefixtures('_use_ipympl')
    def test_mask_2d_with_rectangles():
        da = make_data()
>       masking_tool = MaskingTool(da)
                       ^^^^^^^^^^^^^^^

tests/masking_tool_test.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/wfp5rkjijj55p2ilgjblzb6lbs707yx2-python3.13-scippneutron-26.6.0/lib/python3.13/site-packages/scippneutron/masking.py:140: in __init__
    self.fig = figure_lib[ndim](self.masking_node, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/graphics/figures.py:42: in imagefigure
    return backends.get(group='2d', name='figure')(view_maker, *nodes, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:193: in Figure
    return InteractiveFigure(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:136: in __init__
    self.__init_figure__(View, *args, **kwargs)
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:24: in __init_figure__
    self.view = View(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/graphics/graphicalview.py:101: in __init__
    self.canvas = canvas_maker(
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/canvas.py:157: in __init__
    self.fig = make_figure(figsize=(6.0, 4.0) if figsize is None else figsize)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (), kwargs = {'figsize': (6.0, 4.0)}
fig = <Figure size 600x400 with 0 Axes>

    def make_figure(*args, **kwargs) -> plt.Figure:
        """
        Create a new figure.
    
        If we use ``plt.figure()`` directly, the figures auto-show in the notebooks.
        We want to display the figures when the figure repr is requested.
    
        When using the static backend, we can return the ``plt.Figure`` (note the uppercase
        F) directly.
        When using the interactive backend, we need to do more work. The ``plt.Figure``
        will not have a toolbar nor will it be interactive, as opposed to what
        ``plt.figure`` returns. To fix this, we need to create a manager for the figure
        (see https://stackoverflow.com/a/75477367).
        """
        fig = plt.Figure(*args, **kwargs)
        if is_interactive_backend():
            # Create a manager for the figure, which makes it interactive, as well as
            # making it possible to show the figure from the terminal.
>           plt._backend_mod.new_figure_manager_given_figure(1, fig)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           AttributeError: 'NoneType' object has no attribute 'new_figure_manager_given_figure'

/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/utils.py:71: AttributeError
_______________________________ test_mask_color ________________________________
[gw0] linux -- Python 3.13.13 /nix/store/60m4rxhg2fldqaak400c0lry96ijrzqn-python3-3.13.13/bin/python3.13

    @pytest.mark.usefixtures('_use_ipympl')
    def test_mask_color():
        da = make_data()
        color = to_hex('red')
>       masking_tool = MaskingTool(da, color=color)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/masking_tool_test.py:208: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/wfp5rkjijj55p2ilgjblzb6lbs707yx2-python3.13-scippneutron-26.6.0/lib/python3.13/site-packages/scippneutron/masking.py:140: in __init__
    self.fig = figure_lib[ndim](self.masking_node, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/graphics/figures.py:42: in imagefigure
    return backends.get(group='2d', name='figure')(view_maker, *nodes, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:193: in Figure
    return InteractiveFigure(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:136: in __init__
    self.__init_figure__(View, *args, **kwargs)
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/figure.py:24: in __init_figure__
    self.view = View(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/graphics/graphicalview.py:101: in __init__
    self.canvas = canvas_maker(
/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/canvas.py:157: in __init__
    self.fig = make_figure(figsize=(6.0, 4.0) if figsize is None else figsize)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (), kwargs = {'figsize': (6.0, 4.0)}
fig = <Figure size 600x400 with 0 Axes>

    def make_figure(*args, **kwargs) -> plt.Figure:
        """
        Create a new figure.
    
        If we use ``plt.figure()`` directly, the figures auto-show in the notebooks.
        We want to display the figures when the figure repr is requested.
    
        When using the static backend, we can return the ``plt.Figure`` (note the uppercase
        F) directly.
        When using the interactive backend, we need to do more work. The ``plt.Figure``
        will not have a toolbar nor will it be interactive, as opposed to what
        ``plt.figure`` returns. To fix this, we need to create a manager for the figure
        (see https://stackoverflow.com/a/75477367).
        """
        fig = plt.Figure(*args, **kwargs)
        if is_interactive_backend():
            # Create a manager for the figure, which makes it interactive, as well as
            # making it possible to show the figure from the terminal.
>           plt._backend_mod.new_figure_manager_given_figure(1, fig)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           AttributeError: 'NoneType' object has no attribute 'new_figure_manager_given_figure'

/nix/store/dxjcp5qj86i8wd6h1k7in3b9nkwr0722-python3.13-plopp-26.5.0/lib/python3.13/site-packages/plopp/backends/matplotlib/utils.py:71: AttributeError
=========================== short test summary info ============================
SKIPPED [1] tests/io/sqw/sqw_horace_test.py:28: could not import 'pace_neutrons': No module named 'pace_neutrons'
SKIPPED [1] tests/mantid_test.py:17: Mantid framework is unavailable
SKIPPED [1] tests/mantid_scipp_comparison/histogram_events_test.py: Mantid framework is unavailable
SKIPPED [4] tests/mantid_scipp_comparison/neutron_convert_units_test.py: Mantid framework is unavailable
SKIPPED [3] tests/mantid_scipp_comparison/beamline_calculations_test.py: Mantid framework is unavailable
FAILED tests/masking_tool_test.py::test_mask_2d_with_rectangles - AttributeError: 'NoneType' object has no attribute 'new_figure_manager_given_figure'
FAILED tests/masking_tool_test.py::test_mask_color - AttributeError: 'NoneType' object has no attribute 'new_figure_manager_given_figure'
============ 2 failed, 1386 passed, 10 skipped in 83.65s (0:01:23) =============

We are using matplotlib 3.10.9 at the moment, but will use 3.11.0 in the near future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions