@@ -45,7 +45,7 @@ def test_image_too_large(
4545 When giving an image which is too large, an ``ImageTooLarge`` exception is
4646 raised.
4747 """
48- with pytest .raises (ImageTooLargeError ) as exc :
48+ with pytest .raises (expected_exception = ImageTooLargeError ) as exc :
4949 vws_client .add_target (
5050 name = "x" ,
5151 width = 1 ,
@@ -63,7 +63,7 @@ def test_invalid_given_id(vws_client: VWS) -> None:
6363 causes an ``UnknownTarget`` exception to be raised.
6464 """
6565 target_id = "12345abc"
66- with pytest .raises (UnknownTargetError ) as exc :
66+ with pytest .raises (expected_exception = UnknownTargetError ) as exc :
6767 vws_client .delete_target (target_id = target_id )
6868 assert exc .value .response .status_code == HTTPStatus .NOT_FOUND
6969 assert exc .value .target_id == target_id
@@ -76,7 +76,9 @@ def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None:
7676 """
7777 max_char_value = 65535
7878 bad_name = chr (max_char_value + 1 )
79- with pytest .raises (OopsAnErrorOccurredPossiblyBadNameError ) as exc :
79+ with pytest .raises (
80+ expected_exception = OopsAnErrorOccurredPossiblyBadNameError
81+ ) as exc :
8082 vws_client .add_target (
8183 name = bad_name ,
8284 width = 1 ,
@@ -105,7 +107,7 @@ def test_fail(high_quality_image: io.BytesIO) -> None:
105107 server_secret_key = uuid .uuid4 ().hex ,
106108 )
107109
108- with pytest .raises (FailError ) as exc :
110+ with pytest .raises (expected_exception = FailError ) as exc :
109111 vws_client .add_target (
110112 name = "x" ,
111113 width = 1 ,
@@ -122,7 +124,7 @@ def test_bad_image(vws_client: VWS) -> None:
122124 A ``BadImage`` exception is raised when a non-image is given.
123125 """
124126 not_an_image = io .BytesIO (initial_bytes = b"Not an image" )
125- with pytest .raises (BadImageError ) as exc :
127+ with pytest .raises (expected_exception = BadImageError ) as exc :
126128 vws_client .add_target (
127129 name = "x" ,
128130 width = 1 ,
@@ -149,7 +151,7 @@ def test_target_name_exist(
149151 active_flag = True ,
150152 application_metadata = None ,
151153 )
152- with pytest .raises (TargetNameExistError ) as exc :
154+ with pytest .raises (expected_exception = TargetNameExistError ) as exc :
153155 vws_client .add_target (
154156 name = "x" ,
155157 width = 1 ,
@@ -177,7 +179,7 @@ def test_project_inactive(
177179 server_secret_key = database .server_secret_key ,
178180 )
179181
180- with pytest .raises (ProjectInactiveError ) as exc :
182+ with pytest .raises (expected_exception = ProjectInactiveError ) as exc :
181183 vws_client .add_target (
182184 name = "x" ,
183185 width = 1 ,
@@ -205,7 +207,7 @@ def test_target_status_processing(
205207 application_metadata = None ,
206208 )
207209
208- with pytest .raises (TargetStatusProcessingError ) as exc :
210+ with pytest .raises (expected_exception = TargetStatusProcessingError ) as exc :
209211 vws_client .delete_target (target_id = target_id )
210212
211213 assert exc .value .response .status_code == HTTPStatus .FORBIDDEN
@@ -220,7 +222,7 @@ def test_metadata_too_large(
220222 A ``MetadataTooLarge`` exception is raised if the metadata given is too
221223 large.
222224 """
223- with pytest .raises (MetadataTooLargeError ) as exc :
225+ with pytest .raises (expected_exception = MetadataTooLargeError ) as exc :
224226 vws_client .add_target (
225227 name = "x" ,
226228 width = 1 ,
@@ -260,7 +262,7 @@ def test_request_time_too_skewed(
260262 # >= 1 ticks are acceptable.
261263 with (
262264 freeze_time (auto_tick_seconds = time_difference_from_now ),
263- pytest .raises (RequestTimeTooSkewedError ) as exc ,
265+ pytest .raises (expected_exception = RequestTimeTooSkewedError ) as exc ,
264266 ):
265267 vws_client .get_target_record (target_id = target_id )
266268
@@ -285,7 +287,9 @@ def test_authentication_failure(
285287 with MockVWS () as mock :
286288 mock .add_database (database = database )
287289
288- with pytest .raises (AuthenticationFailureError ) as exc :
290+ with pytest .raises (
291+ expected_exception = AuthenticationFailureError
292+ ) as exc :
289293 vws_client .add_target (
290294 name = "x" ,
291295 width = 1 ,
@@ -313,7 +317,7 @@ def test_target_status_not_success(
313317 application_metadata = None ,
314318 )
315319
316- with pytest .raises (TargetStatusNotSuccessError ) as exc :
320+ with pytest .raises (expected_exception = TargetStatusNotSuccessError ) as exc :
317321 vws_client .update_target (target_id = target_id )
318322
319323 assert exc .value .response .status_code == HTTPStatus .FORBIDDEN
@@ -353,7 +357,7 @@ def test_base_exception(
353357 """
354358 ``VWSException``s has a response property.
355359 """
356- with pytest .raises (VWSError ) as exc :
360+ with pytest .raises (expected_exception = VWSError ) as exc :
357361 vws_client .get_target_record (target_id = "a" )
358362
359363 assert exc .value .response .status_code == HTTPStatus .NOT_FOUND
0 commit comments