Skip to content

Commit ac0cbd7

Browse files
committed
clean up file from tests, make logic simpler in download_file
Use temp directory in test
1 parent fcbf169 commit ac0cbd7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

astroquery/mast/observations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def download_file(self, uri, *, local_path=None, base_url=None, cache=True, clou
535535
# parse a local file path from local_path parameter. Use current directory as default.
536536
filename = os.path.basename(uri)
537537
if not local_path: # local file path is not defined
538-
local_path = os.path.join(os.path.abspath('.'), filename)
538+
local_path = filename
539539
elif os.path.isdir(local_path): # local file path is directory
540540
local_path = os.path.join(local_path, filename) # append filename
541541

astroquery/mast/tests/test_mast.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ def test_observations_download_products(patch_post, tmpdir):
498498

499499
# passing row product
500500
products = mast.Observations.get_product_list('2003738726')
501-
result1 = mast.Observations.download_products(products[0])
501+
result1 = mast.Observations.download_products(products[0],
502+
download_dir=str(tmpdir))
502503
assert isinstance(result1, Table)
503504

504505

astroquery/mast/tests/test_mast_remote.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,16 @@ def test_observations_download_file(self, tmp_path):
405405
=======
406406
assert os.path.exists(Path(os.getcwd(), filename))
407407
<<<<<<< HEAD
408+
<<<<<<< HEAD
408409
=======
409410
Path.unlink(filename) # clean up file
410411
>>>>>>> a8615f1f (space before comment)
411412
=======
412413
assert os.path.exists(Path(os.getcwd(), filename))
413414
>>>>>>> 8033190f (update changes file, add to test case)
415+
=======
416+
Path.unlink(filename) # clean up file
417+
>>>>>>> 4013186e (clean up file from tests, make logic simpler in download_file)
414418

415419
# download with directory as local_path parameter
416420
local_path = Path(tmp_path, filename)

0 commit comments

Comments
 (0)