Skip to content

Commit

Permalink
Merge pull request #255 from samcunliffe/nested-warnings-pytest
Browse files Browse the repository at this point in the history
Expecting two warnings so we need nested `with pytest.warns`.
  • Loading branch information
dstansby authored Feb 6, 2024
2 parents 66dcd79 + 0efd2b2 commit 6037731
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/napari_matplotlib/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def test_fallback_if_missing_dimensions(mocker):
test_css = " Flobble { background-color: rgb(0, 97, 163); } "
mocker.patch("napari.qt.get_current_stylesheet").return_value = test_css
with pytest.warns(RuntimeWarning, match="Unable to find DimensionToken"):
assert from_napari_css_get_size_of("Flobble", (1, 2)) == QSize(1, 2)
with pytest.warns(RuntimeWarning, match="Unable to find Flobble"):
assert from_napari_css_get_size_of("Flobble", (1, 2)) == QSize(
1, 2
)


def test_fallback_if_prelude_not_in_css():
Expand Down

0 comments on commit 6037731

Please sign in to comment.