From 94acb7992422719eedea721f64a1a46f47c439b4 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Fri, 5 Jun 2020 10:47:50 +1200 Subject: [PATCH 1/4] Let travis test everything in icepyx --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2038aef2a..08b190e60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,9 @@ stages: jobs: include: - stage: basic tests - script: pytest icepyx/tests/test_APIformatting.py - icepyx/tests/test_geospatial.py - icepyx/tests/test_is2ref.py - icepyx/tests/test_validate_inputs.py - + script: pytest icepyx/ + # - stage: behind Earthdata - # script: + # script: # - export NSIDC_LOGIN=$NSIDC_LOGIN # - pytest icepyx/tests/behind_NSIDC_API_login.py From 74dd0e31f3cf7d9fb99d7e61402ef4c0204abdc3 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Fri, 5 Jun 2020 10:59:19 +1200 Subject: [PATCH 2/4] Fix test_granule_info --- icepyx/tests/test_granules.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/icepyx/tests/test_granules.py b/icepyx/tests/test_granules.py index d173d69cd..31ea8e2c3 100644 --- a/icepyx/tests/test_granules.py +++ b/icepyx/tests/test_granules.py @@ -22,7 +22,7 @@ def test_granules_info(): # reg_a = ipd.Icesat2Data('ATL06', [-55, 68, -48, 71], ['2019-02-20','2019-02-24'], version='3') # granules = reg_a.granules.avail - granules = [{'producer_granule_id': 'ATL06_20190221121851_08410203_003_01.h5', + grans = [{'producer_granule_id': 'ATL06_20190221121851_08410203_003_01.h5', 'time_start': '2019-02-21T12:19:05.000Z', 'orbit': {'ascending_crossing': '-40.35812957405553', 'start_lat': '59.5', @@ -386,29 +386,25 @@ def test_granules_info(): 'rel': 'http://esipfed.org/ns/fedsearch/1.1/documentation#', 'hreflang': 'en-US', 'href': 'https://doi.org/10.5067/ATLAS/ATL06.003'}]}] - obs = granules.info(granules) + obs = granules.info(grans) - exp = {'Number of available granules': 2, / - 'Average size of granules (MB)': 46.49339485165, / + exp = {'Number of available granules': 2, + 'Average size of granules (MB)': 46.49339485165, 'Total size of all granules (MB)': 92.9867897033} assert obs==exp - - - - - def test_no_granules_in_search_results(): ermsg = "Your search returned no results; try different search parameters" with pytest.raises(AssertionError, match=ermsg): ipd.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-20'], version='2').avail_granules() + def test_correct_granule_list_returned(): reg_a = ipd.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'], version='2') reg_a.avail_granules() obs_grans = [gran['producer_granule_id'] for gran in reg_a.granules] exp_grans = ['ATL06_20190221121851_08410203_002_01.h5', 'ATL06_20190222010344_08490205_002_01.h5', 'ATL06_20190225121032_09020203_002_01.h5', 'ATL06_20190226005526_09100205_002_01.h5'] - - assert set(obs_grans) == set(exp_grans) \ No newline at end of file + + assert set(obs_grans) == set(exp_grans) From 929594e12a0b39cae713fbce9064e89c6556506f Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Tue, 9 Jun 2020 11:46:11 +1200 Subject: [PATCH 3/4] Fix test_correct_granule_list_returned Should be using reg_a.granules.avail instead of reg_a.granules --- icepyx/tests/test_granules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icepyx/tests/test_granules.py b/icepyx/tests/test_granules.py index 31ea8e2c3..8441f41bb 100644 --- a/icepyx/tests/test_granules.py +++ b/icepyx/tests/test_granules.py @@ -404,7 +404,7 @@ def test_no_granules_in_search_results(): def test_correct_granule_list_returned(): reg_a = ipd.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'], version='2') reg_a.avail_granules() - obs_grans = [gran['producer_granule_id'] for gran in reg_a.granules] + obs_grans = [gran['producer_granule_id'] for gran in reg_a.granules.avail] exp_grans = ['ATL06_20190221121851_08410203_002_01.h5', 'ATL06_20190222010344_08490205_002_01.h5', 'ATL06_20190225121032_09020203_002_01.h5', 'ATL06_20190226005526_09100205_002_01.h5'] assert set(obs_grans) == set(exp_grans) From 58ed1ea1b73dc57670d912f11cc529fbaeaafa26 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Wed, 17 Jun 2020 09:55:56 +1200 Subject: [PATCH 4/4] Test everything except behind_NSIDC_API_login.py --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 08b190e60..3ffd4741e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ stages: jobs: include: - stage: basic tests - script: pytest icepyx/ + script: pytest icepyx/ --ignore icepyx/tests/behind_NSIDC_API_login.py # - stage: behind Earthdata # script: