Skip to content

Commit 1ec8393

Browse files
committed
Fix tests
1 parent dd3a352 commit 1ec8393

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

astroquery/mast/tests/test_mast_remote.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
22

33
from re import sub
4+
from pathlib import Path
45
import numpy as np
56
import os
67
import pytest
@@ -309,13 +310,13 @@ def test_observations_download_products_flat(self, tmp_path, msa_product_table):
309310
# Get a product list with 6 duplicate JWST MSA config files
310311
products = msa_product_table
311312

313+
assert len(products) == 6
314+
312315
# Download with flat=True
313316
manifest = mast.Observations.download_products(products, flat=True,
314317
download_dir=tmp_path)
315318

316-
downloaded_path = manifest["Local Path"][0]
317-
filename = os.path.basename(downloaded_path)
318-
assert downloaded_path == (tmp_path / filename).as_posix()
319+
assert Path(manifest["Local Path"][0]).parent == tmp_path
319320

320321
def test_observations_download_products_no_duplicates(self, tmp_path, caplog, msa_product_table):
321322

@@ -340,11 +341,16 @@ def test_observations_get_cloud_uris_no_duplicates(self, msa_product_table):
340341
# Get a product list with 6 duplicate JWST MSA config files
341342
products = msa_product_table
342343

344+
assert len(products) == 6
345+
343346
# enable access to public AWS S3 bucket
344-
mast.Observations.enable_cloud_dataset()
347+
mast.Observations.enable_cloud_dataset(provider='AWS')
345348

346-
# Check duplicate cloud URIs as well
347-
uris = mast.Observations.get_cloud_uris(products)
349+
# Check for cloud URIs. Accept a NoResultsWarning if AWS S3
350+
# doesn't have the file. It doesn't matter as we're only checking
351+
# that the duplicate products have been culled to a single one.
352+
with pytest.warns(NoResultsWarning):
353+
uris = mast.Observations.get_cloud_uris(products)
348354
assert len(uris) == 1
349355

350356
def test_observations_download_file(self):

0 commit comments

Comments
 (0)