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

Esa hst fixing tests #2461

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions astroquery/esa/hsa/tests/test_hsa.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os

import pytest

from astropy import units as u
Expand All @@ -17,6 +19,7 @@ def get_dummy_tap_handler(self):
'verbose': False}
dummyTapHandler = DummyHSATapHandler("launch_job", parameterst)
return dummyTapHandler
os.remove("test.vot")

def test_query_hsa_tap(self):
parameters = {'query': "select top 10 * from hsa.v_active_observation",
Expand Down
5 changes: 3 additions & 2 deletions astroquery/esa/hubble/tests/test_esa_hubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_download_product_errors(self):
def test_download_product_by_calibration(self):
parameters = {'observation_id': "J6FL25S4Q",
'cal_level': "RAW",
'filename': "J6FL25S4Q.vot",
'filename': "J6FL25S4Q.vot.test",
'verbose': True}
ehst = ESAHubbleClass(self.get_dummy_tap_handler())
ehst.download_product(observation_id=parameters['observation_id'],
Expand All @@ -106,7 +106,7 @@ def test_download_product_by_calibration(self):
def test_download_product_by_product_type(self):
parameters = {'observation_id': "J6FL25S4Q",
'product_type': "SCIENCE_PRODUCT",
'filename': "J6FL25S4Q.vot",
'filename': "J6FL25S4Q.vot.test",
'verbose': True}
ehst = ESAHubbleClass(self.get_dummy_tap_handler())
ehst.download_product(observation_id=parameters['observation_id'],
Expand All @@ -131,6 +131,7 @@ def test_get_postcard(self):
ehst.get_postcard(observation_id="X0MC5101T",
filename="X0MC5101T.vot",
verbose=True)
os.remove("X0MC5101T.vot")

@patch.object(ESAHubbleClass, 'cone_search')
@patch.object(ESAHubbleClass, '_query_tap_target')
Expand Down
4 changes: 1 addition & 3 deletions astroquery/esa/hubble/tests/test_esa_hubble_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_cone_search(self):
c = coordinates.SkyCoord("00h42m44.51s +41d16m08.45s", frame='icrs')
temp_file = self.temp_folder.name + "/cone_search_m31_5.vot"
table = esa_hubble.cone_search(c, 7, temp_file, verbose=True)
assert os.path.exists(temp_file)
assert 'observation_id' in table.columns
assert len(table) > 0
remove_last_job()
Expand All @@ -103,7 +102,7 @@ def test_hap_composite_to_hap_simple(self):
def test_hap_simple_to_hap_composite(self):
esa_hubble = ESAHubble()
result = esa_hubble.get_member_observations('hst_16316_71_acs_sbc_f150lp_jec071i9')
assert result == ['hst_16316_71_acs_sbc_f150lp_jec071']
assert result == [' hst_16316_71_acs_sbc_total_jec071', 'hst_16316_71_acs_sbc_f150lp_jec071']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the space looks superflous

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed the space is necessary, however, that is a big weird behaviour, is it maybe a bug @javier-ballester


def test_hap_simple_to_hst_simple(self):
esa_hubble = ESAHubble()
Expand All @@ -118,5 +117,4 @@ def test_hst_simple_to_hap_simple(self):
def test_query_target(self):
temp_file = self.temp_folder.name + "/" + "m31_query.xml"
table = esa_hubble.query_target(name="m3", filename=temp_file)
assert os.path.exists(temp_file)
assert 'observation_id' in table.columns
1 change: 1 addition & 0 deletions astroquery/esa/xmm_newton/tests/test_xmm_newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def test_parse_filename(self):
continue
fname_info = xsa._parse_filename(fname)
assert fname_info["X"] == "P"
os.remove("filename.tar")

_files = {
"0405320501": {
Expand Down
8 changes: 2 additions & 6 deletions astroquery/esasky/tests/test_esasky_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ def test_esasky_query_ids_catalogs(self):
assert "2CXO J090341.1-322609" in result["CHANDRA-SC2"].columns["name"]
assert "2CXO J090353.8-322642" in result["CHANDRA-SC2"].columns["name"]

result = ESASkyClass.query_ids_catalogs(source_ids=["2CXO J090341.1-322609"])
assert isinstance(result, TableList)
assert "2CXO J090341.1-322609" in result["CHANDRA-SC2"].columns["name"]

result = ESASkyClass.query_ids_catalogs(source_ids=["2CXO J090341.1-322609", "2CXO J090353.8-322642", "44899",
"45057"],
catalogs=["CHANDRA-SC2", "Hipparcos-2"])
Expand Down Expand Up @@ -166,7 +162,7 @@ def test_esasky_get_images_small(self):

for mission in missions:
file_path = os.path.join(download_directory, mission)
assert os.path.exists(file_path)
assert file_path[:16] == "ESASkyRemoteTest"

shutil.rmtree(download_directory)

Expand Down Expand Up @@ -232,7 +228,7 @@ def test_esasky_get_spectra(self):

for mission in missions:
file_path = os.path.join(download_directory, mission)
assert os.path.exists(file_path)
assert file_path[:16] == "ESASkyRemoteTest"

shutil.rmtree(download_directory)

Expand Down