Skip to content
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

Cache network responses for testing #217

Open
khaeru opened this issue Aug 19, 2024 · 0 comments
Open

Cache network responses for testing #217

khaeru opened this issue Aug 19, 2024 · 0 comments
Labels
ci Continuous integration & testing enh New features or functionality

Comments

@khaeru
Copy link
Member

khaeru commented Aug 19, 2024

Periodically we will see test failures like this:

ERROR message_ix_models/tests/tools/test_wb.py::test_get_income_group_codelist - requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://api.worldbank.org/v2/sdmx/rest/codelist/WB/
ERROR message_ix_models/tests/tools/test_wb.py::test_assign_income_groups[R12-population-None] - requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://api.worldbank.org/v2/sdmx/rest/codelist/WB/
ERROR message_ix_models/tests/tools/test_wb.py::test_assign_income_groups[R12-count-None] - requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://api.worldbank.org/v2/sdmx/rest/codelist/WB/
ERROR message_ix_models/tests/tools/test_wb.py::test_assign_income_groups[R12-population-0] - requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://api.worldbank.org/v2/sdmx/rest/codelist/WB/
FAILED message_ix_models/tests/tools/test_wb.py::test_make_map - requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: http://api.worldbank.org/v2/sdmx/rest/codelist/WB/

These occur because of intermittent network issues or server issues on the remote end; in this case the World Bank's SDMX API endpoint.

In order to allow our tests to pass regardless, provide a backup copy of the HTTP response (including headers) and put this in place using a test fixture.

@khaeru khaeru added enh New features or functionality ci Continuous integration & testing labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration & testing enh New features or functionality
Projects
None yet
Development

No branches or pull requests

1 participant