@@ -136,11 +136,9 @@ def test_login_no_default_user():
136136 assert casda ._authenticated is False
137137 assert casda .USERNAME == ''
138138
139- with pytest .raises (LoginError ) as excinfo :
139+ with pytest .raises (LoginError , match = r"If you do not pass a username to login\(\)," ) as excinfo :
140140 Casda .login ()
141141
142- assert "If you do not pass a username to login()," in str (excinfo .value )
143-
144142 assert casda ._authenticated is False
145143 assert casda .USERNAME == ''
146144 assert hasattr (casda , '_auth' ) is False
@@ -286,11 +284,9 @@ def test_filter_out_unreleased():
286284def test_stage_data_unauthorised (patch_get ):
287285 table = Table ()
288286
289- with pytest .raises (ValueError ) as excinfo :
287+ with pytest .raises (ValueError , match = r"Credentials must be supplied" ) as excinfo :
290288 Casda .stage_data (table )
291289
292- assert "Credentials must be supplied" in str (excinfo .value )
293-
294290
295291def test_stage_data_empty (patch_get ):
296292 table = Table ()
@@ -323,11 +319,9 @@ def test_stage_data_no_link(patch_get):
323319 fake_login (casda , USERNAME , PASSWORD )
324320 casda .POLL_INTERVAL = 1
325321
326- with pytest .raises (ValueError ) as excinfo :
322+ with pytest .raises (ValueError , match = r"You do not have access to any of the requested data files\." ) as excinfo :
327323 casda .stage_data (table )
328324
329- assert "You do not have access to any of the requested data files." in str (excinfo .value )
330-
331325
332326def test_stage_data (patch_get ):
333327 prefix = 'https://somewhere/casda/datalink/links?'
@@ -370,9 +364,9 @@ def test_cutout_no_args(patch_get):
370364 casda = Casda ()
371365 fake_login (casda , USERNAME , PASSWORD )
372366 casda .POLL_INTERVAL = 1
373- with pytest .raises (ValueError ) as excinfo :
367+ with pytest .raises (ValueError ,
368+ match = r"Please provide cutout parameters such as coordinates, band or channel\." ) as excinfo :
374369 casda .cutout (table )
375- assert "Please provide cutout parameters such as coordinates, band or channel." in str (excinfo .value )
376370
377371
378372def test_cutout_unauthorised (patch_get ):
@@ -384,9 +378,8 @@ def test_cutout_unauthorised(patch_get):
384378 radius = 30 * u .arcmin
385379 centre = SkyCoord (ra , dec )
386380
387- with pytest .raises (ValueError ) as excinfo :
381+ with pytest .raises (ValueError , match = r"Credentials must be supplied to download CASDA image data" ) as excinfo :
388382 Casda .cutout (table , coordinates = centre , radius = radius , verbose = True )
389- assert "Credentials must be supplied to download CASDA image data" in str (excinfo .value )
390383
391384
392385def test_cutout_no_table (patch_get ):
0 commit comments