Skip to content

Commit cd6cbaf

Browse files
committed
Fix deprecatin warning and catching warnings in tests
1 parent 0299e14 commit cd6cbaf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

astroquery/imcce/tests/test_skybot.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import pytest
44
import os
5-
import warnings
65

76
from astroquery.utils.testing_tools import MockResponse
87
import astropy.units as u
@@ -61,11 +60,10 @@ def test_input():
6160
2451200, get_query_payload=True)
6261
assert(a['-rd'] == b['-rd'])
6362

64-
with warnings.catch_warnings(record=True) as w:
63+
with pytest.warns(UserWarning, match='search cone radius'):
6564
a = core.Skybot.cone_search((100, 20), 100, 2451200,
6665
get_query_payload=True)
6766
assert(a['-rd'] == 10)
68-
assert('search cone radius' in str(w[-1].message))
6967

7068
# test epoch input
7169
a = core.Skybot.cone_search((100, 20), 1, 2451200, get_query_payload=True)
@@ -84,11 +82,10 @@ def test_input():
8482
get_query_payload=True)
8583
assert(a['-filter'] == b['-filter'])
8684

87-
with warnings.catch_warnings(record=True) as w:
85+
with pytest.warns(UserWarning, match='positional error'):
8886
a = core.Skybot.cone_search((100, 20), 1, 2451200, position_error=1000,
8987
get_query_payload=True)
9088
assert(a['-filter'] == 120)
91-
assert('positional error' in str(w[-1].message))
9289

9390
# test target filters
9491
a = core.Skybot.cone_search((100, 20), 1, 2451200, get_query_payload=True)

0 commit comments

Comments
 (0)