-
Notifications
You must be signed in to change notification settings - Fork 59
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
Offline testing and test data fetching improvements #1473
Conversation
…adsafe cache location
…ting via pytest-socket, handle SocketBlockedError when performing requests for verification of files already on disk when disabling sockets
On inspection, the No further action is required. |
… `tox` and GitHub Workflows is now its own separate build configuration, `tox` config now offers the `test` label for easier testing, `black` configuration in `tox` and GitHub Workflows is now called `lint` since it contains much more than `black` checks.
…pdated pytest and tox usage to reflect new conventions
…r testdata fetching utilities
…will now bypass `--disable-socket` for testing purposes, added more missing prefetch files, update `test_get_failure` expectations, `gather_session_data` now has a much clearer explanation docstring
…ction-scoped, mark `test_reduce_dims` as `requires_internet` as it relies on remote xarray tutorial data
…ptionally prefetch data (mainly for GitHub CI purposes), update contributing documentation to reflect changes
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
LGTM,
thanks
15dc72b
to
d80ce92
Compare
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
pytest-socket
to the testing dependencies, in order to block HTTP requests"requires_internet"
for tests that absolutely depend on internet access.pytest-socket
'sSocketBlockedError
when attempting to fetch md5 validation files for cached testing data.tox
modifier for running tests without internet access (tox -e offline
)tox -e offline-prefetch
to run the data prefetching command before sockets are disabled inpytest
call.offline
modifier in thetox
configuration.tox -e black
recipe has been renamed totox -e lint
, as this configuration already included several other linting checks.$ xclim prefetch_testing_data
) for manually calling thepopulate_testing_data()
command with branch (--branch/-b
) options.analogs.ipynb
notebook to use the testing data now found inOuranosinc/xclim-testdata
's main branch (see: Add analogs notebook data to main branch xclim-testdata#26)xclim
now has a dedicated CLI command for prefetching theOuranosinc/xclim-testdata
:Running
pytest
will still perform the fetching of data on first run if the user does not have anxclim-testdata
folder in their platform-dependent cache location (/home/$USER/.cache/xclim-testdata
on Linux).Does this PR introduce a breaking change?
Yes:
tox
is now configured to pass positional arguments to thepytest
calls directly. This gives developers much more control when selecting/deselectingpytest
markers. To replicate previous behaviour (skippingslow
tests), mosttox
invocations should resemble the following:xclim
development now requires thepytest-socket
plugin (has been explicitly added to the development requirements). This plugin allows developers to mimic beingoffline
when testing newxclim
features or bug fixes, if they so choose.For better accuracy, the
tox -e black
recipe has been renamed totox -e lint
, as this configuration already included several other linting checks.Other information:
https://github.com/miketheman/pytest-socket
https://tox.wiki/en/latest/config.html#substitutions-for-positional-arguments-in-commands