1515import astropy .units as u
1616from astropy .table import Table
1717import astropy .utils .data as aud
18+ from astropy .utils .exceptions import AstropyDeprecationWarning
1819
1920from ...utils import chunk_read , chunk_report , class_or_instance , commons
2021from ...utils .process_asyncs import async_to_sync_docstr , async_to_sync
@@ -96,8 +97,9 @@ def raise_for_status(self):
9697 status_code = status_code )
9798 monkeypatch .setattr (requests , 'post' , mock_post )
9899
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 )
101103 assert response .url == 'https://github.com/astropy/astroquery'
102104 assert response .data == dict (msg = 'ok' )
103105 assert 'astroquery' in response .headers ['User-Agent' ]
@@ -112,8 +114,9 @@ def mock_get(url, params, timeout, headers={}, status_code=200):
112114 req .raise_for_status = lambda : None
113115 return req
114116 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' )
117120 assert response .url == 'https://github.com/astropy/astroquery?a=b'
118121
119122
@@ -125,15 +128,18 @@ def mock_get(url, params, timeout, headers={}, status_code=200):
125128 req .raise_for_status = lambda : None
126129 return req
127130 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' )
130135 assert response .url == 'https://github.com/astropy/astroquery?a=b'
131136
132137
133138def test_send_request_err ():
134139 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' )
137143
138144
139145col_1 = [1 , 2 , 3 ]
0 commit comments