test_testing.py 629 B

123456789101112131415161718192021222324
  1. import warnings
  2. import pytest
  3. from matplotlib.testing.decorators import check_figures_equal
  4. @pytest.mark.xfail(
  5. strict=True, reason="testing that warnings fail tests"
  6. )
  7. def test_warn_to_fail():
  8. warnings.warn("This should fail the test")
  9. @pytest.mark.parametrize("a", [1])
  10. @check_figures_equal(extensions=["png"])
  11. @pytest.mark.parametrize("b", [1])
  12. def test_parametrize_with_check_figure_equal(a, fig_ref, b, fig_test):
  13. assert a == b
  14. def test_wrap_failure():
  15. with pytest.raises(ValueError, match="^The decorated function"):
  16. @check_figures_equal()
  17. def should_fail(test, ref):
  18. pass