1
1
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2
2
3
3
from re import sub
4
+ from pathlib import Path
4
5
import numpy as np
5
6
import os
6
7
import pytest
@@ -309,13 +310,13 @@ def test_observations_download_products_flat(self, tmp_path, msa_product_table):
309
310
# Get a product list with 6 duplicate JWST MSA config files
310
311
products = msa_product_table
311
312
313
+ assert len (products ) == 6
314
+
312
315
# Download with flat=True
313
316
manifest = mast .Observations .download_products (products , flat = True ,
314
317
download_dir = tmp_path )
315
318
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
319
320
320
321
def test_observations_download_products_no_duplicates (self , tmp_path , caplog , msa_product_table ):
321
322
@@ -340,11 +341,16 @@ def test_observations_get_cloud_uris_no_duplicates(self, msa_product_table):
340
341
# Get a product list with 6 duplicate JWST MSA config files
341
342
products = msa_product_table
342
343
344
+ assert len (products ) == 6
345
+
343
346
# enable access to public AWS S3 bucket
344
- mast .Observations .enable_cloud_dataset ()
347
+ mast .Observations .enable_cloud_dataset (provider = 'AWS' )
345
348
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 )
348
354
assert len (uris ) == 1
349
355
350
356
def test_observations_download_file (self ):
0 commit comments