Skip to content

Commit 0c35dff

Browse files
committed
Refactor test_logo to use mpl_image_compare and track png files in dvc
1 parent 9b61c77 commit 0c35dff

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

pygmt/tests/baseline/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/test_*.png

pygmt/tests/baseline/test_logo.png

-33.1 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 905d5b9f0f8d8b809899dfe9e87d0e91
3+
size: 33347
4+
path: test_logo.png
-113 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 25854f87e4e6f4c30be71bc08a3d430c
3+
size: 114522
4+
path: test_logo_on_a_map.png

pygmt/tests/test_logo.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
"""
22
Tests for fig.logo.
33
"""
4+
import pytest
45
from pygmt import Figure
5-
from pygmt.helpers.testing import check_figures_equal
66

77

8-
@check_figures_equal()
8+
@pytest.mark.mpl_image_compare
99
def test_logo():
1010
"""
1111
Plot a GMT logo of a 2 inch width as a stand-alone plot.
1212
"""
13-
fig_ref, fig_test = Figure(), Figure()
14-
# Use single-character arguments for the reference image
15-
fig_ref.logo(D="x0/0+w2i")
16-
fig_test.logo(position="x0/0+w2i")
17-
return fig_ref, fig_test
13+
fig = Figure()
14+
fig.logo(position="x0/0+w2i")
15+
return fig
1816

1917

20-
@check_figures_equal()
18+
@pytest.mark.mpl_image_compare
2119
def test_logo_on_a_map():
2220
"""
2321
Plot a GMT logo in the upper right corner of a map.
2422
"""
25-
fig_ref, fig_test = Figure(), Figure()
26-
# Use single-character arguments for the reference image
27-
fig_ref.coast(R="-90/-70/0/20", J="M6i", G="chocolate", B="")
28-
fig_ref.logo(D="jTR+o0.1i/0.1i+w3i", F="")
29-
30-
fig_test.coast(
31-
region=[-90, -70, 0, 20], projection="M6i", land="chocolate", frame=True
32-
)
33-
fig_test.logo(position="jTR+o0.1i/0.1i+w3i", box=True)
34-
return fig_ref, fig_test
23+
fig = Figure()
24+
fig.coast(region=[-90, -70, 0, 20], projection="M6i", land="chocolate", frame=True)
25+
fig.logo(position="jTR+o0.1i/0.1i+w3i", box=True)
26+
return fig

0 commit comments

Comments
 (0)