File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -310,6 +310,7 @@ def wait_for_target_processed(
310310 self ,
311311 target_id : str ,
312312 seconds_between_requests : float = 0.2 ,
313+ timeout_seconds : float = 60 * 5 ,
313314 ) -> None :
314315 """
315316 Wait up to five minutes (arbitrary) for a target to get past the
@@ -322,18 +323,19 @@ def wait_for_target_processed(
322323 We wait 0.2 seconds by default, rather than less, than that to
323324 decrease the number of calls made to the API, to decrease the
324325 likelihood of hitting the request quota.
326+ timeout_seconds: The maximum number of seconds to wait for the
327+ target to be processed.
325328
326329 Raises:
327330 ~vws.exceptions.AuthenticationFailure: The secret key is not
328331 correct.
329332 ~vws.exceptions.Fail: There was an error with the request. For
330333 example, the given access key does not match a known database.
331334 TimeoutError: The target remained in the processing stage for more
332- than five minutes .
335+ than ``timeout_seconds`` seconds .
333336 ~vws.exceptions.UnknownTarget: The given target ID does not match a
334337 target in the database.
335338 """
336- timeout_seconds = 60 * 5
337339
338340 @timeout (seconds = timeout_seconds )
339341 def decorated () -> None :
Original file line number Diff line number Diff line change 66from typing import Optional
77
88import pytest
9+ import timeout_decorator
910from mock_vws import MockVWS
1011from mock_vws .database import VuforiaDatabase
1112
@@ -387,15 +388,15 @@ def test_custom_timeout(
387388
388389 report = client .get_target_summary_report (target_id = target_id )
389390 assert report ['status' ] == 'processing'
390- with pytest .raises (TimeoutError ):
391+ with pytest .raises (timeout_decorator . TimeoutError ):
391392 client .wait_for_target_processed (
392393 target_id = target_id ,
393394 timeout_seconds = 0.1 ,
394395 )
395396
396397 client .wait_for_target_processed (
397398 target_id = target_id ,
398- timeout_seconds = 0.4 ,
399+ timeout_seconds = 0.5 ,
399400 )
400401 report = client .get_target_summary_report (target_id = target_id )
401402 assert report ['status' ] != 'processing'
You can’t perform that action at this time.
0 commit comments