@@ -59,7 +59,7 @@ def test_SgrAstar(self, temp_dir):
5959 result_c = alma .query_region (c , 1 * u .deg )
6060 assert b'2011.0.00217.S' in result_c ['Project code' ]
6161
62- def test_m83 (self , temp_dir ):
62+ def test_m83 (self , temp_dir , recwarn ):
6363 alma = Alma ()
6464 alma .cache_location = temp_dir
6565
@@ -72,14 +72,19 @@ def test_m83(self, temp_dir):
7272 assert len (link_list ) >= 47
7373
7474 # test re-staging
75- with pytest .raises (requests .HTTPError ) as ex :
76- link_list = alma .stage_data (uids )
77- assert ex .value .args [0 ] == ('Received an error 405: this may indicate you have '
78- 'already staged the data. Try downloading the '
79- 'file URLs directly with download_files.' )
80-
75+ # (has been replaced with warning)
76+ #with pytest.raises(requests.HTTPError) as ex:
77+ # link_list = alma.stage_data(uids)
78+ #assert ex.value.args[0] == ('Received an error 405: this may indicate you have '
79+ # 'already staged the data. Try downloading the '
80+ # 'file URLs directly with download_files.')
81+ link_list = alma .stage_data (uids )
82+ w = recwarn .pop ()
83+ assert (str (w .message ) == ('Error 405 received. If you have previously staged the '
84+ 'same UIDs, the result returned is probably correct,'
85+ ' otherwise you may need to create a fresh astroquery.Alma instance.' ))
8186
82- def test_stage_data (self , temp_dir ):
87+ def test_stage_data (self , temp_dir , recwarn ):
8388 alma = Alma ()
8489 alma .cache_location = temp_dir
8590
@@ -100,11 +105,16 @@ def test_stage_data(self, temp_dir):
100105 os .path .split (result ['URL' ][0 ])[1 ])
101106
102107 # test re-staging
103- with pytest .raises (requests .HTTPError ) as ex :
104- result = alma .stage_data ([uid ])
105- assert ex .value .args [0 ] == ('Received an error 405: this may indicate you have '
106- 'already staged the data. Try downloading the '
107- 'file URLs directly with download_files.' )
108+ #with pytest.raises(requests.HTTPError) as ex:
109+ # result = alma.stage_data([uid])
110+ #assert ex.value.args[0] == ('Received an error 405: this may indicate you have '
111+ # 'already staged the data. Try downloading the '
112+ # 'file URLs directly with download_files.')
113+ result = alma .stage_data ([uid ])
114+ w = recwarn .pop ()
115+ assert (str (w .message ) == ('Error 405 received. If you have previously staged the '
116+ 'same UIDs, the result returned is probably correct,'
117+ ' otherwise you may need to create a fresh astroquery.Alma instance.' ))
108118
109119
110120 def test_doc_example (self , temp_dir ):
0 commit comments