Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/visualization/test_mpl_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_draw_misc_ops_2():
measure q -> c;
"""
fig = mpl_draw(qasm3)
return fig
assert fig is not None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B1 — pytest-mpl needs this return.

This test carries @pytest.mark.mpl_image_compare(baseline_dir="images", filename="misc2.png"). The plugin receives the figure to compare against tests/visualization/images/misc2.png from the test's return value, so removing the return hands it None:

this branch:  E   AttributeError: 'NoneType' object has no attribute 'savefig'
                  pytest_mpl/plugin.py:752
main:             Error: Image dimensions did not match.   <- comparison runs

(reproduce with pytest tests/visualization/test_mpl_draw.py --mpl)

Without --mpl the test still passes either way, which is why CI stays green — but the comparison can no longer work for anyone who does run it.

On the warning: it isn't being emitted. The full suite on the repo's pinned pytest (9.1.1) reports zero PytestReturnNotNoneWarning — pytest-mpl wraps the test, so pytest never sees the returned figure. The same goes for test_draw_bell (L178) and test_draw_misc_ops (L201), which also return fig and are correct as they stand.



def test_draw_raises_unsupported_format_error():
Expand Down
Loading