Skip to content

Commit

Permalink
Merge pull request #107 from FloraSauerbronn/create-test-transect
Browse files Browse the repository at this point in the history
Adding test_plotting in tests
  • Loading branch information
ocefpaf authored Jun 12, 2024
2 parents 2540a31 + 4eb5f37 commit 8de0bec
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
- name: Full Tests
shell: bash -l {0}
run: |
python -m pytest -rxs --cov=gliderpy tests
python -m pytest -rxs --cov=gliderpy --mpl tests
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pyarrow
pytest
pytest-cov
pytest-flake8
pytest-mpl
pytest-sugar
pytest-xdist
setuptools_scm
Expand Down
Binary file added tests/baseline/test_plot_transect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Test transect."""

from pathlib import Path

import pytest

from gliderpy.fetchers import GliderDataFetcher
from gliderpy.plotting import plot_transect

root = Path(__file__).parent


@pytest.mark.mpl_image_compare(baseline_dir=root.joinpath("baseline/"))
def test_plot_transect():
glider_grab = GliderDataFetcher()

glider_grab.fetcher.dataset_id = "whoi_406-20160902T1700"
df = glider_grab.to_pandas()
# Generate the plot
fig, ax = plot_transect(df, "temperature")

# Return the figure for pytest-mpl to compare
return fig

0 comments on commit 8de0bec

Please sign in to comment.