Skip to content

Commit

Permalink
Merge pull request #2326 from andamian/fixcadc
Browse files Browse the repository at this point in the history
Fix in the cadc module in anticipation of coming changes to the servers
  • Loading branch information
bsipocz authored Mar 19, 2022
2 parents 97f6f30 + 800006d commit 44fc1a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions astroquery/cadc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,10 @@ def get_data_urls(self, query_result, include_auxiliaries=False):
urlencode({'ID': pid_sublist,
'REQUEST': 'downloads-only'}, True)))
for service_def in datalink:
if service_def.semantics == 'http://www.openadc.org/caom2#pkg':
# pkg is an alternative for downloading multiple
if service_def.semantics in ['http://www.opencadc.org/caom2#pkg', '#package']:
# TODO http://www.openadc.org/caom2#pkg has been replaced
# by "package". Removed it after CADC rolls out the change
# package is an alternative for downloading multiple
# data files in a tar file as an alternative to separate
# downloads. It doesn't make much sense in this case so
# filter it out.
Expand Down
9 changes: 6 additions & 3 deletions astroquery/cadc/tests/test_cadctap.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,13 @@ class Result:
file3.semantics = '#preview'
file3.access_url = 'https://get.your.data/previewpath'
# add the package file that should be filtered out
package_file_old = Mock()
package_file_old.semantics = 'http://www.opencadc.org/caom2#pkg'
package_file = Mock()
package_file.semantics = 'http://www.openadc.org/caom2#pkg'
result = [file1, file2, file3, package_file]
with patch('pyvo.dal.adhoc.DatalinkResults.from_result_url') as dl_results_mock:
package_file.semantics = '#package'
result = [file1, file2, file3, package_file_old, package_file]
with patch('pyvo.dal.adhoc.DatalinkResults.from_result_url') as \
dl_results_mock:
dl_results_mock.return_value = result
cadc = Cadc()
cadc._request = get # mock the request
Expand Down
3 changes: 3 additions & 0 deletions astroquery/cadc/tests/test_cadctap_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def test_authsession(self):

@pytest.mark.skipif(one_test, reason='One test mode')
@pytest.mark.skipif(not pyvo_OK, reason='not pyvo_OK')
@pytest.mark.xfail(reason='#2325')
def test_get_images(self):
cadc = Cadc()
coords = '08h45m07.5s +54d18m00s'
Expand Down Expand Up @@ -253,6 +254,7 @@ def test_get_images_against_AS(self):

@pytest.mark.skipif(one_test, reason='One test mode')
@pytest.mark.skipif(not pyvo_OK, reason='not pyvo_OK')
@pytest.mark.xfail(reason='#2325')
def test_get_images_async(self):
cadc = Cadc()
coords = '01h45m07.5s +23d18m00s'
Expand Down Expand Up @@ -313,6 +315,7 @@ def test_list_tables(self):
reason='Requires real CADC certificate (CADC_CERT '
'environment variable)')
@pytest.mark.skipif(not pyvo_OK, reason='not pyvo_OK')
@pytest.mark.xfail(reason='#2325')
def test_list_jobs(self):
cadc = Cadc()
cadc.login(certificate_file=os.environ['CADC_CERT'])
Expand Down

0 comments on commit 44fc1a8

Please sign in to comment.