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

Reinstate test_download_granules_without_subsetting #581

Merged
merged 15 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ install:
- source activate icepyx-env
- pip install -r requirements.txt -r requirements-dev.txt
- pip install -e .[complete]
# Setup codecov
# includes an integrity check of the uploader as recommended by CodeCov
- curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
- gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
- shasum -a 256 -c codecov.SHA256SUM
- chmod +x codecov

stages:
- name: basic tests
Expand All @@ -28,17 +37,11 @@ jobs:
include:
- stage: basic tests
script: pytest icepyx/ --verbose --cov app --ignore=icepyx/tests/test_behind_NSIDC_API_login.py --ignore=icepyx/tests/test_auth.py
# includes an integrity check of the uploader as recommended by CodeCov
after_success:
- curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
- curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
- gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
- shasum -a 256 -c codecov.SHA256SUM
- chmod +x codecov
- ./codecov -t ${CODECOV_TOKEN}
- stage: behind Earthdata
script:
- export EARTHDATA_PASSWORD=$NSIDC_LOGIN
- pytest icepyx/tests/test_behind_NSIDC_API_login.py icepyx/tests/test_auth.py
after_success:
- ./codecov -t ${CODECOV_TOKEN}
5 changes: 5 additions & 0 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ def place_order(
status = statuslist[0]
print("Initial status of your order request at NSIDC is: ", status)

# If status is already finished without going into pending/processing
if status.startswith("complete"):
loop_response = self.session.get(statusURL)
loop_root = ET.fromstring(loop_response.content)

# Continue loop while request is still processing
while status == "pending" or status == "processing":
print(
Expand Down
40 changes: 35 additions & 5 deletions icepyx/tests/test_behind_NSIDC_API_login.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
Integration tests that require authentication to Earthdata login.
"""

import glob
import json
import os
import pytest
Expand Down Expand Up @@ -49,8 +54,33 @@ def test_download_granules_with_subsetting(reg, session):
reg.download_granules(path)


# def test_download_granules_without_subsetting(reg_a, session):
# path = './downloads'
# reg_a.order_granules(session, subset=False)
# reg_a.download_granules(session, path)
# #check that the max extent of the downloaded granules isn't subsetted
def test_download_granules_without_subsetting(reg, session, capsys):
"""
Test that granules can be ordered from NSIDC and downloaded with the `subset=False`
option.
"""
path = "./downloads"

reg.order_granules(verbose=False, subset=False, email=False)
out, err = capsys.readouterr() # capture stdout and stderr
assert out.startswith(
"Total number of data order requests is 1 for 3 granules.\n"
"Data request 1 of 1 is submitting to NSIDC\n"
)
assert err == ""

assert reg.reqparams == {
"client_string": "icepyx",
"include_meta": "Y",
"page_num": 0,
"page_size": 2000,
"request_mode": "async",
"short_name": "ATL06",
"version": "006",
}
assert len(reg.granules.orderIDs) == 2
assert int(reg.granules.orderIDs[0]) >= 5_000_000_000_000

reg.download_granules(path=path)
assert len(glob.glob(pathname=f"{path}/processed_ATL06_201902*.h5")) == 3
# check that the max extent of the downloaded granules isn't subsetted