From fc3c2d46e5ef52e23a636cfc99b5ca1b0641270a Mon Sep 17 00:00:00 2001 From: veenstrajelmer Date: Wed, 25 Sep 2024 11:16:32 +0200 Subject: [PATCH] changed ordering --- tests/test_download.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tests/test_download.py b/tests/test_download.py index 02abe93f..c15a2902 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -236,6 +236,21 @@ def test_download_hycom(tmp_path): assert ds.time.to_pandas().iloc[-1] == pd.Timestamp('2010-01-02') +@pytest.mark.requiressecrets +@pytest.mark.unittest +def test_download_era5_unsupported_varkey(): + date_min = '2010-01-31' + date_max = '2010-02-01' + longitude_min, longitude_max, latitude_min, latitude_max = 2, 3, 51, 52 #test domain + varkey = 'unexisting' + with pytest.raises(KeyError) as e: + dfmt.download_ERA5(varkey, + longitude_min=longitude_min, longitude_max=longitude_max, latitude_min=latitude_min, latitude_max=latitude_max, + date_min=date_min, date_max=date_max, + dir_output='.', overwrite=True) + assert '"unexisting" not available' in str(e.value) + + @pytest.mark.requiressecrets @pytest.mark.unittest @pytest.mark.timeout(60) # useful since CDS downloads are terribly slow sometimes, so skip in that case @@ -264,19 +279,3 @@ def test_download_era5(file_nc_era5_pattern): msl_encoding = ds['msl'].encoding assert str(msl_encoding['dtype']) == 'float32' assert 'scale_factor' not in msl_encoding.keys() - - -@pytest.mark.requiressecrets -@pytest.mark.unittest -@pytest.mark.timeout(60) # useful since CDS downloads are terribly slow sometimes, so skip in that case -def test_download_era5_unsupported_varkey(): - date_min = '2010-01-31' - date_max = '2010-02-01' - longitude_min, longitude_max, latitude_min, latitude_max = 2, 3, 51, 52 #test domain - varkey = 'unexisting' - with pytest.raises(KeyError) as e: - dfmt.download_ERA5(varkey, - longitude_min=longitude_min, longitude_max=longitude_max, latitude_min=latitude_min, latitude_max=latitude_max, - date_min=date_min, date_max=date_max, - dir_output='.', overwrite=True) - assert '"unexisting" not available' in str(e.value)