-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark unit tests with @pytest.mark.benchmark part 2 #2924
Conversation
Specifically test_virtual_file, test_virtualfile_from_data_required_z_matrix, test_virtualfile_from_vectors, and test_virtualfile_from_matrix
CodSpeed Performance ReportMerging #2924 will not alter performanceFalling back to comparing Summary
Benchmarks breakdown
|
@pytest.mark.benchmark | ||
def test_load_remote_dataset_benchmark_with_region(): | ||
""" | ||
Benchmark loading a remote dataset with 'region'. | ||
""" | ||
data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) | ||
assert data.name == "seafloor_age" | ||
assert data.attrs["long_name"] == "age of seafloor crust" | ||
assert data.attrs["cpt"] == "@earth_age.cpt" | ||
assert data.attrs["units"] == "Myr" | ||
assert data.attrs["horizontal_datum"] == "WGS84" | ||
assert data.gmt.registration == 0 | ||
assert data.shape == (11, 21) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of benchmarking all the various load_earth_*
functions, I just made created a new one that tests the _load_remote_dataset
function, and it should cover the refactoring happening at #2917. Note that this test is somewhat duplicating test_earth_age_01d_with_region
, but should be ok I hope.
pygmt/tests/test_figure.py
Outdated
@pytest.mark.benchmark | ||
def test_figure_repr(): | ||
""" | ||
Make sure that figure output's PNG and HTML printable representations look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was a little unsure which test to benchmark for figure.py
, so I picked this one that tests __repr_png__
, since it goes through the savefig
and _preview
calls.
@pytest.mark.benchmark | ||
def test_earth_relief_holes(): | ||
""" | ||
Check that the @earth_relief_20m_holes.grd dataset loads without errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only benchmarking test_earth_relief_holes
since it calls both pygmt.which
and pygmt.io.load_dataarray
. The other sample datasets call pygmt.which
and pd.read_csv
only.
Description of proposed changes
Follow-up to #2908, this is where we mark the unit tests for any PyGMT functions we want to benchmark with the @pytest.mark.benchmark decorator.
Benchmark report at https://codspeed.io/GenericMappingTools/pygmt/branches/pytest/mark-benchmark-part2
See #2924 (comment) below on which new tests have been marked for benchmarking. Will prioritize PyGMT functions that use temporary files, and low-level clib functions that should be benchmarked. General discussion on which tests to mark can go in #2910.
Part 2 of addressing #2910. Covers test functions from test_binstats to test_filter1d according to the list in #2910 (comment).
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version