Skip to content

Commit facd20b

Browse files
committed
MAINT: cleanup workarounds for pivot <1.5 versions
1 parent 46d512a commit facd20b

File tree

5 files changed

+10
-36
lines changed

5 files changed

+10
-36
lines changed

astroquery/alma/core.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
from astropy import units as u
2121
from astropy.time import Time
2222

23-
try:
24-
from pyvo.dal.sia2 import SIA2_PARAMETERS_DESC, SIA2Service
25-
except ImportError:
26-
# Can be removed once min version of pyvo is 1.5
27-
from pyvo.dal.sia2 import SIA_PARAMETERS_DESC as SIA2_PARAMETERS_DESC
28-
from pyvo.dal.sia2 import SIAService as SIA2Service
23+
from pyvo.dal.sia2 import SIA2_PARAMETERS_DESC, SIA2Service
2924

3025
from ..exceptions import LoginError
3126
from ..utils import commons

astroquery/alma/tests/test_alma_remote.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
from astropy import units as u
1111
import numpy as np
1212
import pytest
13-
try:
14-
# This requires pyvo 1.4
15-
from pyvo.dal.exceptions import DALOverflowWarning
16-
except ImportError:
17-
pass
13+
14+
from pyvo.dal.exceptions import DALOverflowWarning
1815

1916
from astroquery.exceptions import CorruptDataWarning
2017
from .. import Alma
@@ -52,7 +49,6 @@ def alma(request):
5249
@pytest.mark.remote_data
5350
class TestAlma:
5451
def test_public(self, alma):
55-
# This warning was added in pyvo 1.4, but we don't test older versions with remote-data
5652
with pytest.warns(expected_warning=DALOverflowWarning,
5753
match="Partial result set. Potential causes MAXREC, async storage space, etc."):
5854
results = alma.query(payload=None, public=True, maxrec=100)
@@ -88,7 +84,6 @@ def test_freq(self, alma):
8884
def test_bands(self, alma):
8985
payload = {'band_list': ['5', '7']}
9086
# Added maxrec here as downloading and reading the results take too long.
91-
# This warning was added in pyvo 1.4, but we don't test older versions with remote-data
9287
with pytest.warns(expected_warning=DALOverflowWarning,
9388
match="Partial result set. Potential causes MAXREC, async storage space, etc."):
9489
result = alma.query(payload, maxrec=1000)

astroquery/ipac/irsa/core.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@
1414

1515
from pyvo.dal import TAPService
1616

17-
try:
18-
from pyvo.dal.sia2 import SIA2Service, SIA2_PARAMETERS_DESC
19-
except ImportError:
20-
# Can be removed once min version of pyvo is 1.5
21-
from pyvo.dal.sia2 import SIA_PARAMETERS_DESC as SIA2_PARAMETERS_DESC
22-
from pyvo.dal.sia2 import SIAService as SIA2Service
17+
from pyvo.dal.sia2 import SIA2Service, SIA2_PARAMETERS_DESC
2318

2419
from astroquery import log
2520
from astroquery.query import BaseVOQuery

astroquery/ipac/irsa/tests/test_irsa_remote.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
from astropy.coordinates import SkyCoord
77
from astropy.utils.exceptions import AstropyDeprecationWarning
88

9-
try:
10-
# This requires pyvo 1.4
11-
from pyvo.dal.exceptions import DALOverflowWarning
12-
except ImportError:
13-
pass
9+
from pyvo.dal.exceptions import DALOverflowWarning
1410

1511
from astroquery.ipac.irsa import Irsa
1612

astroquery/simbad/tests/test_simbad_remote.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
# Maybe we need to expose SimbadVOTableResult to be in the public API?
1212
from astroquery.simbad.core import SimbadVOTableResult
1313
from astroquery.exceptions import BlankResponseWarning
14-
from packaging import version
15-
from pyvo import __version__ as pyvo_version
16-
try:
17-
# This requires pyvo 1.4
18-
from pyvo.dal.exceptions import DALOverflowWarning
19-
except ImportError:
20-
pass
14+
15+
from pyvo.dal.exceptions import DALOverflowWarning
2116

2217

2318
# M42 coordinates
@@ -273,11 +268,9 @@ def test_query_tap(self):
273268
expect = "letters numbers\n------- -------\n a 1\n b 2\n c 3"
274269
assert expect == str(result)
275270
# Test query_tap raised errors
276-
# DALOverflowWarning exists since pyvo 1.4
277-
if version.parse(pyvo_version) > version.parse('1.4'):
278-
with pytest.raises(DALOverflowWarning, match="Partial result set *"):
279-
truncated_result = Simbad.query_tap("SELECT * from basic", maxrec=2)
280-
assert len(truncated_result) == 2
271+
with pytest.raises(DALOverflowWarning, match="Partial result set *"):
272+
truncated_result = Simbad.query_tap("SELECT * from basic", maxrec=2)
273+
assert len(truncated_result) == 2
281274
with pytest.raises(ValueError, match="The maximum number of records cannot exceed 2000000."):
282275
Simbad.query_tap("select top 5 * from basic", maxrec=10e10)
283276
with pytest.raises(ValueError, match="Query string contains an odd number of single quotes.*"):

0 commit comments

Comments
 (0)