Tests: allow running tests without internet with a --skip-tests-requiring-internet
switch
#413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Geocoders tests currently rely on the Internet presence to make actual queries to the geocoding services.
This is inconvenient in the following ways:
One solution would be to record actual requests (see #203) and replay them in tests instead of making actual requests. There are two problems with this solution:
Another approach (which is implemented here) is to add an option (
--skip-tests-requiring-internet
) to the test suite which skips tests requiring network. The test coverage would definitely be lower than the usual runs, however, it is still useful to quickly run a subset of tests to verify that things are not completely broken.--skip-tests-requiring-internet
works by raisingpytest.skip
at the moment of the first network request in a test. So the code preparing the request is actually getting executed, although it is not validated.Usage: