Skip to content

Conversation

@bjlittle
Copy link
Member

This PR adds some simple testing infra-structure changes to support external test data.

The iris-grib package is not shipped with the test data within this repo, and as such, developers cannot easily test a packaged version of iris-grib. Note that, the tests themselves are indeed shipped with the iris-grib package.

This PR adds an iris_grib.tests.skip_data decorator and also allows developers to specify the external directory that contains the iris-grib data using the GRIB_TEST_DATA_PATH environment variable.

In addition to this, developers may also set the GRIB_TEST_NO_DATA environment variable to explicitly skip tests (via the skip_data decorator) that require said external test data.

@pp-mo pp-mo self-assigned this Jun 16, 2020
@coveralls
Copy link

coveralls commented Jun 16, 2020

Coverage Status

Coverage remained the same at 92.479% when pulling 1def4d9 on bjlittle:testdata-hook into 2e99443 on SciTools:master.

@bjlittle bjlittle changed the title support external grib test data support external grib test data skipper Jun 16, 2020
@bjlittle bjlittle changed the title support external grib test data skipper support external grib test data skipper and hook Jun 16, 2020
@bjlittle bjlittle changed the title support external grib test data skipper and hook external grib test data skipper and hook Jun 16, 2020
Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

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

Suggested to explain the skip warning a bit.
Otherwise all good I reckon : I have now tested behaviour with no iris testdata, and no grib testdata.
all 👍

no_data = not os.path.isdir(dpath) or os.environ.get(evar)

skip = unittest.skipIf(
condition=no_data, reason="Test(s) require external data."
Copy link
Member

Choose a reason for hiding this comment

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

"Test(s) require external data." is a bit brief, and indistinguishable from the Iris missing-testdata message.
? Could we go with ...

    reason = ("Test(s) require test grib files."
              "\nSee : https://github.com/SciTools/iris-grib/tree/v0.15.1/iris_grib/tests/testdata")

Copy link
Member Author

Choose a reason for hiding this comment

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

@pp-mo No worries. Good idea. I've changed it to something different, but similar:

Test(s) require missing external GRIB test data.

I think it's a bit noisy to have a URI in there... anyways, see what you think 👍

@pp-mo
Copy link
Member

pp-mo commented Jun 17, 2020

@bjlittle I think it's a bit noisy to have a URI in there

Yeah, I thought you might say that !
Too true, this will do fine 😉

@pp-mo pp-mo merged commit 17a51d0 into SciTools:master Jun 17, 2020
@bjlittle bjlittle deleted the testdata-hook branch June 17, 2020 12:38
@bjlittle
Copy link
Member Author

@lbdreyer This change should come in handy for testing a packaged version of iris-grib 😄

@lbdreyer
Copy link
Member

@lbdreyer This change should come in handy for testing a packaged version of iris-grib

Very much so! Makes testing much easier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants