Skip to content

Migrate tests to use dvc-tracked baseline images #1131

Closed
@seisman

Description

@seisman

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

  1. Migrate existing baseline images to dvc
  2. 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.

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.


Here are some notes for the migration based on my own experience. These are all open for comments and suggestions:

  1. Tests should focus on testing PyGMT-specific codes. Some tests that test wrapper aliases can be removed.
  2. Use SI units and long-form parameters, unless there is a special reason
  3. Each test should focus on testing one feature/bug.
  4. 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).
  5. 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.
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedHelping hands are appreciatedmaintenanceBoring but important stuff for the core devs

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions