Skip to content
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

Show test execution times in pytest #835

Merged
merged 1 commit into from
Feb 5, 2021
Merged

Show test execution times in pytest #835

merged 1 commit into from
Feb 5, 2021

Conversation

seisman
Copy link
Member

@seisman seisman commented Feb 5, 2021

Description of proposed changes

Show the slowest tests with executation times > 0.2 s (the default is 0.005 s).

Reference: https://docs.pytest.org/en/stable/usage.html#profiling-test-execution-duration

Addresses #584

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added the maintenance Boring but important stuff for the core devs label Feb 5, 2021
@seisman seisman added this to the 0.3.0 milestone Feb 5, 2021
@seisman
Copy link
Member Author

seisman commented Feb 5, 2021

Now we know the slowest tests:

============================== slowest durations ===============================
4.48s call     tests/test_coast.py::test_coast_aliases[png]
3.38s call     tests/test_grdview.py::test_grdview_with_perspective_and_zaxis_frame[png]
2.45s call     gridops.py::pygmt.gridops.grdfilter
2.19s call     tests/test_coast.py::test_coast_world_mercator
2.06s call     tests/test_figure.py::test_shift_origin
1.91s call     src/inset.py::pygmt.src.inset.inset
1.74s call     tests/test_coast.py::test_coast_dcw_state[png]
1.69s call     tests/test_inset.py::test_inset_aliases[png]
1.60s call     tests/test_logo.py::test_logo_on_a_map[png]
1.59s call     tests/test_plot.py::test_plot_from_file
1.57s call     tests/test_coast.py::test_coast_dcw_continent[png]
1.45s call     tests/test_coast.py::test_coast_dcw_list[png]
1.44s call     tests/test_coast.py::test_coast_dcw_multiple[png]
1.44s call     tests/test_grdcontour.py::test_grdcontour_labels[png]
1.42s call     tests/test_plot3d.py::test_plot3d_from_file[png]
1.42s call     tests/test_grdimage.py::test_grdimage_shading_xarray[True-png]
1.41s call     tests/test_grdimage.py::test_grdimage_shading_xarray[+a30+nt0.8-png]
1.35s call     tests/test_coast.py::test_coast_dcw_single[png]
1.35s call     tests/test_coast.py::test_coast_iceland[png]
1.32s call     tests/test_config.py::test_config
1.16s call     tests/test_basemap.py::test_basemap_winkel_tripel
1.14s call     tests/test_coast.py::test_coast
1.13s call     tests/test_colorbar.py::test_colorbar_shading_string[png]
1.12s call     tests/test_colorbar.py::test_colorbar_shading_float[png]
1.10s call     tests/test_colorbar.py::test_colorbar_shading_list[png]

@seisman seisman requested a review from a team February 5, 2021 18:57
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Surprising how so many of the fig.coast tests are slow. This will definitely help with #584 down the track.

@seisman seisman merged commit 5f4c70c into master Feb 5, 2021
@seisman seisman deleted the pytest-time branch February 5, 2021 19:12
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants