Skip to content

Commit

Permalink
fixup! Add inital image comparison tests for transects
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-moth committed Jan 16, 2024
1 parent badb684 commit 8c0f71c
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
addopts = [
# TODO Work around till the mpl-baseline-path ini option is included in the
# next pytest-mpl release.
"--mpl-baseline-path", "tests/baseline_images",
]

testpaths = ["tests"]
filterwarnings = [
"error",
Expand All @@ -18,6 +24,11 @@ markers = [
"tutorial: Tests that involve the tutorial datasets",
]

mpl-use-full-test-name = true
# TODO This option will be included in the next version of pytest-mpl.
# Till then, it is added using addopts above
# mpl-baseline-path = "tests/baseline_images"

[tool.mypy]
python_version = "3.9"
plugins = ["numpy.typing.mypy_plugin"]
Expand Down
Binary file removed tests/baseline/test_plot.png
Binary file not shown.
Binary file removed tests/baseline/test_plot_no_intersection.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_add_landmarks():
assert text.xy == landmark[1].coords.xy


@pytest.mark.mpl_image_compare
@pytest.mark.matplotlib(mock_coast=True)
@pytest.mark.tutorial
def test_plot(
Expand All @@ -68,8 +69,7 @@ def test_plot(
axes = figure.axes[0]
assert axes.get_title() == 'Temperature\n2022-05-11T14:00'

matplotlib.pyplot.savefig(tmp_path / 'plot.png')
logger.info("Saved plot to %r", tmp_path / 'plot.png')
return figure


@pytest.mark.matplotlib(mock_coast=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@pytest.mark.mpl_image_compare
@pytest.mark.matplotlib(mock_coast=True)
@pytest.mark.matplotlib
@pytest.mark.tutorial
def test_plot(
datasets: pathlib.Path,
Expand Down

0 comments on commit 8c0f71c

Please sign in to comment.