Skip to content

Commit f5df713

Browse files
rickynilssonbsipocz
authored andcommitted
Patch TAP tables call
1 parent 7587e03 commit f5df713

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

astroquery/nasa_exoplanet_archive/core.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,9 @@ class NasaExoplanetArchiveClass(BaseQuery):
134134
@property
135135
def TAP_TABLES(self):
136136
if not hasattr(self, '_tap_tables'):
137-
self._tap_tables = self.get_tap_tables(conf.url_tap)
137+
self._tap_tables = get_tap_tables()
138138
return self._tap_tables
139139

140-
@class_or_instance
141-
def get_tap_tables(self, url):
142-
"""Tables accessed by API are gradually migrating to TAP service. Generate current list of tables in TAP."""
143-
tap = pyvo.dal.tap.TAPService(baseurl=url)
144-
response = tap.search(query="select * from TAP_SCHEMA.tables", language="ADQL")
145-
tables = [table for table in response["table_name"].data if "TAP_SCHEMA." not in table]
146-
return tables
147-
148140
# Ensures methods can be called either as class methods or instance methods. This is the basic query method.
149141
@class_or_instance
150142
def query_criteria_async(self, table, get_query_payload=False, cache=None, **criteria):

astroquery/nasa_exoplanet_archive/tests/test_nasa_exoplanet_archive.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@
7575
),
7676
),
7777
]
78-
TAP_TABLES = [
79-
("ps", dict(where="hostname='Kepler-11'")),
80-
("pscomppars", dict(where="hostname='WASP-166'"))
81-
# ("ml", dict(where="pl_name='MOA-2010-BLG-353L b'")), # new microlensing table not ready for the wild yet
82-
# ("keplernames", dict(where="kepid=10601284")), # not yet officially supported
83-
# ("k2names", dict(where="epic_host='EPIC 206027655'")), # not yet officially supported
84-
]
78+
# TAP_TABLES = [
79+
# ("ps", dict(where="hostname='Kepler-11'")),
80+
# ("pscomppars", dict(where="hostname='WASP-166'"))
81+
# # ("ml", dict(where="pl_name='MOA-2010-BLG-353L b'")), # new microlensing table not ready for the wild yet
82+
# # ("keplernames", dict(where="kepid=10601284")), # not yet officially supported
83+
# # ("k2names", dict(where="epic_host='EPIC 206027655'")), # not yet officially supported
84+
# ]
8585

8686

8787
def mock_get(self, method, url, *args, **kwargs): # pragma: nocover
@@ -139,6 +139,7 @@ def patch_get(request): # pragma: nocover
139139

140140

141141
def test_regularize_object_name(patch_get):
142+
NasaExoplanetArchive._tap_tables = ['list']
142143
assert NasaExoplanetArchive._regularize_object_name("kepler 2") == "HAT-P-7"
143144
assert NasaExoplanetArchive._regularize_object_name("kepler 1 b") == "TrES-2 b"
144145

@@ -152,6 +153,7 @@ def test_backwards_compat(patch_get):
152153
These are the tests from the previous version of this interface.
153154
They query old tables by default and should return InvalidTableError.
154155
"""
156+
NasaExoplanetArchive._tap_tables = ['list']
155157

156158
# test_hd209458b_exoplanets_archive
157159
with pytest.warns(AstropyDeprecationWarning):
@@ -187,6 +189,7 @@ def test_backwards_compat(patch_get):
187189
@pytest.mark.filterwarnings("error")
188190
@pytest.mark.parametrize("table,query", API_TABLES)
189191
def test_api_tables(patch_get, table, query):
192+
NasaExoplanetArchive._tap_tables = ['list']
190193
data = NasaExoplanetArchive.query_criteria(table, select="*", **query)
191194
assert len(data) > 0
192195

0 commit comments

Comments
 (0)