Ouranosinc / xclim

Library of derived climate variables, ie climate indicators, based on xarray.
https://xclim.readthedocs.io/en/stable/
Apache License 2.0
328 stars 58 forks source link

Test suite does not run without internet access #1468

Closed huard closed 1 year ago

huard commented 1 year ago

Addressing a Problem?

I sometimes work offline and it's problematic that the test suite does not work without internet access.

Potential Solution

Rely on cached test data.

Additional context

No response

Contribution

Code of Conduct

Zeitsperre commented 1 year ago

Just tried this now in a slightly modified branch. The good news is that the vast majority of tests will pass as they are currently written. The tests that require some aid are:

FAILED tests/test_analog.py::test_spatial_analogs[seuclidean] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[nearest_neighbor] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[zech_aslan] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[szekely_rizzo] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[friedman_rafsky] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[kolmogorov_smirnov] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs[kldiv] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_unsupported_spatial_analog_method - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_analog.py::test_spatial_analogs_multi_index - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_missing.py::TestMissingAnyFills::test_hydro - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_calendar.py::test_get_calendar[file0-noleap-365] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_calendar.py::test_get_calendar[file1-360_day-360] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fine_fuel_moisture_code - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_duff_moisture_code - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_drought_code - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_initial_spread_index - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_build_up_index - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_weather_index - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_cffwis_indicator - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_partitioning.py::test_hawkins_sutton_smoke - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_season_R[id1_default-kwargs0] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_temperature.py::test_degree_days_exceedance_date - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_season_R[id2_default-kwargs1] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_season_R[id3_default-kwargs2] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_season_R[id1_start10_end3-kwargs3] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_fire_season_R[id1_start10_end3_YS-kwargs4] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_cffwis.py::TestCFFWIS::test_gfwed_and_indicators - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_testing_utils.py::TestFileRequests::test_get_failure - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_testing_utils.py::TestFileRequests::test_open_dataset_with_bad_file - AssertionError: assert 'bc51206e6462fc8ed08fd4926181274c' != 'bc51206e6462fc8ed08fd4926181274c'
FAILED tests/test_sdba/test_measures.py::test_bias - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_relative_bias - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_ratio - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_rmse - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_adjustment.py::TestQM::test_add_dims[True] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_adjustment.py::TestQM::test_add_dims[False] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_mae - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_annual_cycle_correlation - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_adjustment.py::TestExtremeValues::test_real_data - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_measures.py::test_taylordiagram - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_processing.py::test_stack_variables - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_processing.py::test_unpack_moving_yearly_window[True] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_processing.py::test_unpack_moving_yearly_window[False] - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
FAILED tests/test_sdba/test_properties.py::TestProperties::test_get_measure - urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

Will open a PR to see what can be done.

Zeitsperre commented 1 year ago

Additionally, this might be useful for later: https://github.com/miketheman/pytest-socket