Tests: allow running tests without internet with a --skip-tests-requiring-internet switch - #413
#413Merged
KostyaEsmukov merged 1 commit intoJun 21, 2020
mastergeopy/geopy:masterfrom
feature/skip-tests-requiring-internetgeopy/geopy:feature/skip-tests-requiring-internetCopy head branch name to clipboard
Merged
Tests: allow running tests without internet with a --skip-tests-requiring-internet switch#413KostyaEsmukov merged 1 commit intomastergeopy/geopy:masterfrom feature/skip-tests-requiring-internetgeopy/geopy:feature/skip-tests-requiring-internetCopy head branch name to clipboard
--skip-tests-requiring-internet switch#413KostyaEsmukov merged 1 commit into
mastergeopy/geopy:masterfrom
feature/skip-tests-requiring-internetgeopy/geopy:feature/skip-tests-requiring-internetCopy head branch name to clipboard
Conversation
…iring-internet` switch
This might be useful for downstream package maintainers to run tests
of the built package.
Also it is now used in CI where it would help to avoid spending geocoders
quota for test runs which are doomed to failure.
Usage:
python -m pytest --skip-tests-requiring-internet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-internetworks by raisingpytest.skipat 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: