15
15
import astropy .units as u
16
16
from astropy .table import Table
17
17
import astropy .utils .data as aud
18
+ from astropy .utils .exceptions import AstropyDeprecationWarning
18
19
19
20
from ...utils import chunk_read , chunk_report , class_or_instance , commons
20
21
from ...utils .process_asyncs import async_to_sync_docstr , async_to_sync
@@ -96,8 +97,9 @@ def raise_for_status(self):
96
97
status_code = status_code )
97
98
monkeypatch .setattr (requests , 'post' , mock_post )
98
99
99
- response = commons .send_request ('https://github.com/astropy/astroquery' ,
100
- data = dict (msg = 'ok' ), timeout = 30 )
100
+ with pytest .warns (AstropyDeprecationWarning ):
101
+ response = commons .send_request ('https://github.com/astropy/astroquery' ,
102
+ data = dict (msg = 'ok' ), timeout = 30 )
101
103
assert response .url == 'https://github.com/astropy/astroquery'
102
104
assert response .data == dict (msg = 'ok' )
103
105
assert 'astroquery' in response .headers ['User-Agent' ]
@@ -112,8 +114,9 @@ def mock_get(url, params, timeout, headers={}, status_code=200):
112
114
req .raise_for_status = lambda : None
113
115
return req
114
116
monkeypatch .setattr (requests , 'get' , mock_get )
115
- response = commons .send_request ('https://github.com/astropy/astroquery' ,
116
- dict (a = 'b' ), 60 , request_type = 'GET' )
117
+ with pytest .warns (AstropyDeprecationWarning ):
118
+ response = commons .send_request ('https://github.com/astropy/astroquery' ,
119
+ dict (a = 'b' ), 60 , request_type = 'GET' )
117
120
assert response .url == 'https://github.com/astropy/astroquery?a=b'
118
121
119
122
@@ -125,15 +128,18 @@ def mock_get(url, params, timeout, headers={}, status_code=200):
125
128
req .raise_for_status = lambda : None
126
129
return req
127
130
monkeypatch .setattr (requests , 'get' , mock_get )
128
- response = commons .send_request ('https://github.com/astropy/astroquery' ,
129
- dict (a = 'b' ), 1 * u .min , request_type = 'GET' )
131
+ with pytest .warns (AstropyDeprecationWarning ):
132
+ response = commons .send_request ('https://github.com/astropy/astroquery' ,
133
+ dict (a = 'b' ), 1 * u .min ,
134
+ request_type = 'GET' )
130
135
assert response .url == 'https://github.com/astropy/astroquery?a=b'
131
136
132
137
133
138
def test_send_request_err ():
134
139
with pytest .raises (ValueError ):
135
- commons .send_request ('https://github.com/astropy/astroquery' ,
136
- dict (a = 'b' ), 60 , request_type = 'PUT' )
140
+ with pytest .warns (AstropyDeprecationWarning ):
141
+ commons .send_request ('https://github.com/astropy/astroquery' ,
142
+ dict (a = 'b' ), 60 , request_type = 'PUT' )
137
143
138
144
139
145
col_1 = [1 , 2 , 3 ]
0 commit comments