From 8eff9dff25ef7b1c07a8237ca51df00dad946402 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:10:55 +1300 Subject: [PATCH 1/6] Refactor test_image to plot @circuit.png instead of test_logo.png So that we don't need to pull test_logo.png from dvc, or run test_logo first to generate the image. --- pygmt/tests/baseline/test_image.png.dvc | 4 ++-- pygmt/tests/test_image.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pygmt/tests/baseline/test_image.png.dvc b/pygmt/tests/baseline/test_image.png.dvc index 6db5f253752..8e36bf6a7a0 100644 --- a/pygmt/tests/baseline/test_image.png.dvc +++ b/pygmt/tests/baseline/test_image.png.dvc @@ -1,4 +1,4 @@ outs: -- md5: c2e05c0d6fb17bcc7bf2f96193f91ad6 - size: 10005 +- md5: d7d0d71a44a232d5907dbd44f7a08f18 + size: 30811 path: test_image.png diff --git a/pygmt/tests/test_image.py b/pygmt/tests/test_image.py index 06e9c73bb72..9a618e4dd6c 100644 --- a/pygmt/tests/test_image.py +++ b/pygmt/tests/test_image.py @@ -1,14 +1,11 @@ """ 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 @@ -17,5 +14,5 @@ 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 From e473a4a5face7427964e1901265d23f4f8510876 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:14:30 +1300 Subject: [PATCH 2/6] Add @circuit.png to cache --- pygmt/helpers/testing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 10c10f4c6d3..50fc941191f 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -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", From cff99291380cdbfea286849f5de6770e7aa122ec Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:15:39 +1300 Subject: [PATCH 3/6] Remove dvc pull step from ci_tests_legacy.yaml --- .github/workflows/ci_tests_legacy.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 346c6a740ca..81449848ed0 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -76,7 +76,6 @@ jobs: rioxarray sphinx-gallery build - dvc make pip pytest @@ -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 From afe2d233c56f03a06d7f671e2ec03ea705c33e2a Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:23:33 +1300 Subject: [PATCH 4/6] Temporarily enable cache_data and ci_tests_legacy and --- .github/workflows/cache_data.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index 998158789b5..c3b48e37529 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -12,7 +12,7 @@ name: Cache data on: # Uncomment the 'pull_request' line below to manually re-cache data artifacts - # pull_request: + pull_request: # Schedule runs on 12 noon every Sunday schedule: - cron: '0 12 * * 0' diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 81449848ed0..c4802b916db 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -11,7 +11,7 @@ name: GMT Legacy Tests on: # push: # branches: [ main ] - # pull_request: + pull_request: # types: [ready_for_review] # paths-ignore: # - 'doc/**' From c0d662154a1ba5fba45767eb5328e4a2477f0b61 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:36:43 +1300 Subject: [PATCH 5/6] Try running test_image on Windows to see if it crashes --- pygmt/tests/test_image.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pygmt/tests/test_image.py b/pygmt/tests/test_image.py index 9a618e4dd6c..768937fe211 100644 --- a/pygmt/tests/test_image.py +++ b/pygmt/tests/test_image.py @@ -1,13 +1,10 @@ """ Test Figure.image. """ -import sys - import pytest from pygmt import Figure -@pytest.mark.skipif(sys.platform == "win32", reason="crashes on Windows") @pytest.mark.mpl_image_compare def test_image(): """ From 121e589b024682c89bb744106b959aa2cbfdab9c Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:50:52 +1300 Subject: [PATCH 6/6] Revert "Temporarily enable cache_data and ci_tests_legacy and" This reverts commit afe2d233c56f03a06d7f671e2ec03ea705c33e2a. --- .github/workflows/cache_data.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index c3b48e37529..998158789b5 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -12,7 +12,7 @@ name: Cache data on: # Uncomment the 'pull_request' line below to manually re-cache data artifacts - pull_request: + # pull_request: # Schedule runs on 12 noon every Sunday schedule: - cron: '0 12 * * 0' diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index c4802b916db..81449848ed0 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -11,7 +11,7 @@ name: GMT Legacy Tests on: # push: # branches: [ main ] - pull_request: + # pull_request: # types: [ready_for_review] # paths-ignore: # - 'doc/**'