Skip to content

Add a check in check_figures_equal that the test did not accidentally plot on non-fixture figures #18581

Description

@anntzer

Problem

check_figures_equal relies on the test plotting onto fig_test and fig_ref, not elsewhere (e.g. on newly instantiated figures, as noticed in #18579).

Proposed Solution

It should be reasonable to also fail the test if the test function creates new pyplot figures to catch errors as in #18579.

Additional context and prior art

Instead, we could also change check_figures_equal to just not pass the two figures in and always expect the test function to create exactly two pyplot figures itself and check these, but then it's a bit arbitrary which figure is the reference and which is the test (although that only really (barely) matters for display purposes in triage_tests.py), and feels a bit dirty (even ignoring the API break, which is as always manageable)...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions