Skip to content

Gallerytest one fig per test#3

Draft
rcomer wants to merge 7 commits intoplaceholderfrom
gallerytest-one-test-per-fig
Draft

Gallerytest one fig per test#3
rcomer wants to merge 7 commits intoplaceholderfrom
gallerytest-one-test-per-fig

Conversation

@rcomer
Copy link
Owner

@rcomer rcomer commented Jun 19, 2022

🚀 Pull Request

Description

If/when we adopt pytest-mpl we will need to return a single figure from each test.
https://github.com/matplotlib/pytest-mpl

Since some of the gallery examples produce more than one figure, we need a way to split them up. The simplest option is to run the whole example for each of our N tests, but have each test select a different figure to return. That would be less efficient than the current situation, but how much that matters depends on how lightweight the relevant examples are.

The GloSea "lagged ensemble" example is particularly slow, probably because it loads multiple pp-fields. So this branch implements a class that runs that code once to provide the two figures for the two tests. All other examples run the code once per test, as above.

Note this branch still uses the iris.tests.check_graphic function rather than pytest-mpl.


Consult Iris pull request check list

@rcomer rcomer changed the title Gallerytest one test per fig Gallerytest one fig per test Jun 19, 2022
@rcomer
Copy link
Owner Author

rcomer commented Jun 19, 2022

Gallery test timings:

Which suggests the extra time to run the examples multiple times is within the CI variability.

@rcomer
Copy link
Owner Author

rcomer commented Jun 19, 2022

Treating the GloSea example the same as all the others, the gallery tests took 68.34 seconds or 67.36 seconds (ran twice to get an idea of variability). Seems to be a significant increase, so it's probably worth having the special handling for the GloSea example.

@rcomer rcomer marked this pull request as draft June 19, 2022 14:39
@rcomer rcomer force-pushed the gallerytest-one-test-per-fig branch from 4461cf4 to c7ad34d Compare June 20, 2022 17:04
@rcomer rcomer force-pushed the pytest-gallerytest branch from f782d73 to feddd39 Compare June 28, 2022 10:00
@rcomer rcomer force-pushed the gallerytest-one-test-per-fig branch from c7ad34d to bb685fd Compare July 23, 2022 15:17
@rcomer rcomer force-pushed the pytest-gallerytest branch 2 times, most recently from ca43e78 to 48824b4 Compare July 29, 2022 10:49
@rcomer rcomer force-pushed the gallerytest-one-test-per-fig branch from bb685fd to 22348cb Compare July 30, 2022 10:36
@rcomer rcomer force-pushed the pytest-gallerytest branch 2 times, most recently from b39aaaf to b0eb077 Compare August 12, 2022 10:36
rcomer added 7 commits August 13, 2022 18:51
class for GloSea example to reduce runtime

this class addition brings total run time of gallery tests from ~3:40 to ~2:35
(total time before this branch ~2:20).  Timings on ancient laptop.

tidyings
This reverts commit 814251d.
@rcomer rcomer force-pushed the gallerytest-one-test-per-fig branch from 22348cb to c7b3ab0 Compare August 13, 2022 17:53
@rcomer rcomer changed the base branch from pytest-gallerytest to placeholder August 13, 2022 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant