Skip to content

Commit 12b0359

Browse files
committed
Add a regression test for issues #2093 and #2099
Currently querying the Gaia archive can return results from `gaiadr2.gaia_source` even if the user has specified that they wish to query a different table. This commit adds a regression test to see if the right table actually gets queried.
1 parent 241d896 commit 12b0359

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

astroquery/gaia/tests/test_gaiatap.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import os
1919
import pytest
2020

21+
from astroquery.gaia import conf
2122
from astroquery.gaia.core import GaiaClass
2223
from astroquery.gaia.tests.DummyTapHandler import DummyTapHandler
2324
from astroquery.utils.tap.conn.tests.DummyConnHandler import DummyConnHandler
@@ -344,6 +345,21 @@ def test_cone_search_async(self):
344345
None,
345346
np.int32)
346347

348+
# Regression test for #2093 and #2099 - changing the MAIN_GAIA_TABLE
349+
# had no effect.
350+
# The preceding tests should have used the default value.
351+
assert 'gaiadr2.gaia_source' in job.parameters['query']
352+
# Test changing the table name through conf.
353+
conf.MAIN_GAIA_TABLE = 'name_from_conf'
354+
job = tap.cone_search_async(sc, radius)
355+
assert 'name_from_conf' in job.parameters['query']
356+
# Changing the value through the class should overrule conf.
357+
tap.MAIN_GAIA_TABLE = 'name_from_class'
358+
job = tap.cone_search_async(sc, radius)
359+
assert 'name_from_class' in job.parameters['query']
360+
# Cleanup.
361+
conf.reset('MAIN_GAIA_TABLE')
362+
347363
def __check_results_column(self, results, columnName, description, unit,
348364
dataType):
349365
c = results[columnName]

0 commit comments

Comments
 (0)