Closed
Description
After #1036, we start to use the new dvc
based workflow for baseline images. We need to migrate existing baseline images to dvc, and also rewrite some tests. Please read the Testing Plots section in the contributing guides for the details of the new dvc
based workflow. (Related to #963)
This issue tracks the progress of the migration.
Main Tasks
- Migrate existing baseline images to dvc
- Migrate
@check_figures_equal
tests to@pytest.mark.mpl_image_compare
Migrate existing baseline images to dvc
For each item, you should see the test file pygmt/tests/test_xxx.py
and baseline images pygmt/tests/baseline/test_xxx_*.png
.
- basemap (Migrate Figure.basemap tests to dvc #1096, @seisman)
- coast (Migrate Figure.coast tests to dvc #1103, @willschlitzer)
- colorbar (Migrate Figure.colorbar tests to use dvc #1143 @willschlitzer)
- config (Migrate pygmt.config tests to dvc #1165 @seisman)
- contour (Migrate test_contour to use dvc #1146 @michaelgrund)
- grdcontour (Migrate Figure.grdcontour tests to dvc #1158 @michaelgrund)
- grdimage (Migrate Figure.grdimage tests to use dvc #1169 @willschlitzer)
- grdview (Migrate Figure.grdview tests to dvc #1154 @weiji14)
- legend (Migrate Figure.legend tests to use dvc #1166 @willschlitzer)
- test_makecpt.py (Migrate makecpt tests to use dvc #1168 @willschlitzer)
- meca (Migrate Figure.meca tests to dvc #1153 @seisman)
- plot (Migrate Figure.plot tests to dvc #1142 @michaelgrund)
- text (Migrate Figure.text tests to dvc #1167 @michaelgrund)
- shift_origin (in
pygmt/tests/test_figure.py
) (Migrate test_figure_shift_origin to dvc #1133, @seisman)
Migrate @check_figures_equal
tests to @pytest.mark.mpl_image_compare
Some tests in the following files use @check_figures_equal
, and should be migrated to @pytest.mark.mpl_image_compare
.
- test_basemap.py (Migrate Figure.basemap tests to dvc #1096, @seisman)
- test_coast.py (Migrate Figure.coast tests to dvc #1103, @willschlitzer)
- test_colorbar.py (Migrate Figure.colorbar tests to use dvc #1143 @willschlitzer)
- test_config.py (Migrate pygmt.config tests to dvc #1165 @seisman)
- test_grd2cpt.py (Migrate pygmt.grd2cpt tests to use dvc #1162 @willschlitzer)
- test_grdcontour.py (Migrate Figure.grdcontour tests to dvc #1158 @michaelgrund)
- test_grdimage.py (Migrate Figure.grdimage tests to use dvc #1169 @willschlitzer)
- test_grdview.py (Migrate Figure.grdview tests to dvc #1154 @weiji14)
- test_inset.py (Migrate Figure.inset tests to use dvc #1163 @willschlitzer)
- test_makecpt.py (Migrate makecpt tests to use dvc #1168 @willschlitzer)
- test_plot.py (Migrate Figure.plot tests to dvc #1142 @michaelgrund)
- test_plot3d.py (Migrate Figure.plot3d tests to dvc #1164 @michaelgrund)
- test_subplot.py (Migrate Figure.subplot tests to dvc #1170 @michaelgrund)
- test_text.py (Migrate Figure.text tests to dvc #1167 @michaelgrund)
Here are some notes for the migration based on my own experience. These are all open for comments and suggestions:
- Tests should focus on testing PyGMT-specific codes. Some tests that test wrapper aliases can be removed.
- Use SI units and long-form parameters, unless there is a special reason
- Each test should focus on testing one feature/bug.
- Although we no longer store baseline images in the git repository, please try to generate smaller images if possible (e.g., set the figure width to 15c, not 30c, use a simpler dataset, use low-resolution coastline or earth relief data).
- Think about how to generated baseline images that are easy to verify their correctness. For example, when plotting a data point on a figure, it's easier to verify that the data is plotted at the correct position when frame and gridlines are also shown.
- You don't have to migrate all tests in one test file in one PR. Adding/updating too many baseline images also makes the PR difficult to review. Try to change no more than 5 tests in one PR.