Skip to content

Commit

Permalink
Refactor test_image to plot @circuit.png instead of test_logo.png (#2922
Browse files Browse the repository at this point in the history
)

So that we don't need to pull test_logo.png from dvc,
or run test_logo first to generate the image.

* Add @circuit.png to cache
* Remove dvc pull step from ci_tests_legacy.yaml
* Try running test_image on Windows to see if it crashes
  • Loading branch information
weiji14 committed Dec 27, 2023
1 parent c550f83 commit 94e4598
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci_tests_legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
rioxarray
sphinx-gallery
build
dvc
make
pip
pytest
Expand All @@ -101,10 +100,6 @@ jobs:
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt
ls -lhR ~/.gmt
# Pull baseline image data from dvc remote (DAGsHub)
- name: Pull baseline image data from dvc remote
run: dvc pull pygmt/tests/baseline/test_logo.png && ls -lhR pygmt/tests/baseline/

# Install the package that we want to test
- name: Install the package
run: make install
Expand Down
1 change: 1 addition & 0 deletions pygmt/helpers/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def download_test_data():
"@S90E000.earth_wdmam_03m_g.nc", # Specific grid for 03m test
# Other cache files
"@capitals.gmt",
"@circuit.png",
"@earth_relief_20m_holes.grd",
"@EGM96_to_36.txt",
"@MaunaLoa_CO2.txt",
Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/baseline/test_image.png.dvc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
outs:
- md5: c2e05c0d6fb17bcc7bf2f96193f91ad6
size: 10005
- md5: d7d0d71a44a232d5907dbd44f7a08f18
size: 30811
path: test_image.png
8 changes: 1 addition & 7 deletions pygmt/tests/test_image.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
"""
Test Figure.image.
"""
import os
import sys

import pytest
from pygmt import Figure

TEST_IMG = os.path.join(os.path.dirname(__file__), "baseline", "test_logo.png")


@pytest.mark.skipif(sys.platform == "win32", reason="crashes on Windows")
@pytest.mark.mpl_image_compare
def test_image():
"""
Place images on map.
"""
fig = Figure()
fig.image(TEST_IMG, position="x0/0+w2c", box="+pthin,blue")
fig.image(imagefile="@circuit.png", position="x0/0+w2c", box="+pthin,blue")
return fig

0 comments on commit 94e4598

Please sign in to comment.