Skip to content

Commit 71d4681

Browse files
committed
Ignore DALOverflowWarning in tests
1 parent 94c2b38 commit 71d4681

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

astroquery/eso/core.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class EsoClass(QueryWithLogin):
8787
DOWNLOAD_URL = "https://dataportal.eso.org/dataPortal/file/"
8888
AUTH_URL = "https://www.eso.org/sso/oidc/token"
8989
GUNZIP = "gunzip"
90-
USE_DEV_TAP = True
90+
USE_DEV_TAP = False
9191

9292
def __init__(self, timeout=None):
9393
super().__init__()
@@ -254,7 +254,8 @@ def query_tap_service(self,
254254

255255
tap = pyvo.dal.TAPService(EsoClass.tap_url())
256256
table_to_return = None
257-
log.debug(f"querystr = {query_str}")
257+
logmsg = f"querystr = {query_str}"
258+
log.debug(logmsg)
258259
try:
259260
if not cache:
260261
with cache_conf.set_temp("cache_active", False):
@@ -274,9 +275,9 @@ def query_tap_service(self,
274275
except Exception as e:
275276
raise RuntimeError(
276277
f"Unhandled exception {type(e)}\n"
277-
"While executing the following query:\n\n"
278-
f"{query_str}\n\n"
279-
"See examples here: https://archive.eso.org/tap_obs/examples\n\n") from e
278+
"While executing the following query:\n\n"
279+
f"{query_str}\n\n"
280+
"See examples here: https://archive.eso.org/tap_obs/examples\n\n") from e
280281

281282
if len(table_to_return) < 1:
282283
warnings.warn("Query returned no results", NoResultsWarning)

astroquery/eso/tests/test_eso_remote.py

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
@pytest.mark.remote_data
4545
class TestEso:
46+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
4647
def test_query_tap_service(self):
4748
eso = Eso()
4849
eso.ROW_LIMIT = 7
@@ -53,6 +54,7 @@ def test_query_tap_service(self):
5354
assert len(t) > 0, "Table length is zero"
5455
assert len(t) == eso.ROW_LIMIT, f"Table length is {lt}, expected {eso.ROW_LIMIT}"
5556

57+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
5658
def test_row_limit(self):
5759
eso = Eso()
5860
eso.ROW_LIMIT = 5
@@ -73,6 +75,7 @@ def test_row_limit(self):
7375
n = len(table)
7476
assert n == eso.ROW_LIMIT, f"Expected {eso.ROW_LIMIT}; Obtained {n}"
7577

78+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
7679
def test_top(self):
7780
eso = Eso()
7881
top = 5
@@ -91,6 +94,7 @@ def test_top(self):
9194
n = len(table)
9295
assert n == top, f"Expected {top}; Obtained {n}"
9396

97+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
9498
def test_SgrAstar(self):
9599
eso = Eso()
96100
eso.ROW_LIMIT = 1
@@ -130,6 +134,7 @@ def test_SgrAstar(self):
130134
assert 'target_name' in result_s.colnames
131135
assert 'b319' in result_s['target_name']
132136

137+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
133138
def test_multicollection(self, tmp_path):
134139

135140
eso = Eso()
@@ -151,6 +156,7 @@ def test_multicollection(self, tmp_path):
151156
for tc in test_collections:
152157
assert counts[tc] > 0, f"{tc} : collection not present in results"
153158

159+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
154160
def test_empty_return(self):
155161
# test for empty return with an object from the North
156162
eso = Eso()
@@ -164,6 +170,7 @@ def test_empty_return(self):
164170

165171
assert len(result_s) == 0
166172

173+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
167174
def test_SgrAstar_remotevslocal(self, tmp_path):
168175
eso = Eso()
169176
# TODO originally it was 'gravity', but it is not yet ready in the TAP ISTs
@@ -236,6 +243,7 @@ def test_apex_retrieval(self):
236243

237244
assert np.all(tbl == tblb)
238245

246+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
239247
def test_each_instrument_SgrAstar(self, tmp_path):
240248
eso = Eso()
241249
eso.cache_location = tmp_path
@@ -272,6 +280,7 @@ def test_each_instrument_SgrAstar(self, tmp_path):
272280
assert result is not None, f"query_instrument({instrument}) returned None"
273281
assert len(result) > 0, f"query_instrument({instrument}) returned no records"
274282

283+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
275284
def test_each_collection_and_SgrAstar(self, tmp_path):
276285
eso = Eso()
277286
eso.cache_location = tmp_path
@@ -301,6 +310,7 @@ def test_each_collection_and_SgrAstar(self, tmp_path):
301310
assert len(generic_result) > 0, \
302311
f"query_collection({collection}) returned no records"
303312

313+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
304314
def test_mixed_case_instrument(self, tmp_path):
305315
eso = Eso()
306316
eso.cache_location = tmp_path
@@ -314,6 +324,7 @@ def test_mixed_case_instrument(self, tmp_path):
314324

315325
assert all(result1.values_equal(result2))
316326

327+
@pytest.mark.filterwarnings("ignore::pyvo.dal.exceptions.DALOverflowWarning")
317328
def test_main_SgrAstar(self):
318329
eso = Eso()
319330
eso.ROW_LIMIT = 5

astroquery/eso/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def py2adql(table: str, columns: Union[List, str] = None,
8181
if count_only:
8282
columns = ['count(*)']
8383

84-
8584
# Build the query
8685
query_string = ', '.join(columns) + ' from ' + table
8786
if len(wc) > 0:

setup.cfg

-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ filterwarnings =
8787
ignore:The upstream SHA API has been changed:UserWarning
8888
# CDMS triggers this, but we don't use it directly
8989
ignore: The 'strip_cdata' option of HTMLParser:DeprecationWarning
90-
# TAP triggers DALOverflowWarning when the maxrec of the queries is set
91-
ignore:Partial result set:pyvo.dal.exceptions.DALOverflowWarning
9290

9391
markers =
9492
bigdata: marks tests that are expected to trigger a large download (deselect with '-m "not bigdata"')

0 commit comments

Comments
 (0)