Skip to content

Commit 7c8a56f

Browse files
renovate-botparthea
authored andcommitted
chore(deps): update dependency backoff to v2 (#386)
* chore(deps): update dependency backoff to v2 * test: backoff wait_gen arg expects a generator Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 618e3c1 commit 7c8a56f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
backoff==1.11.1
1+
backoff==2.0.0
22
flaky==3.7.0
33
pytest==7.1.2

translation/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,28 @@ def bucket():
4545

4646
def on_backoff(invocation_dict):
4747
"""Backoff callback; create a testing bucket for each backoff run"""
48-
invocation_dict['kwargs']['bucket'] = next(get_ephemeral_bucket())
48+
invocation_dict["kwargs"]["bucket"] = next(get_ephemeral_bucket())
4949

5050

5151
# If necessary, retry test function while backing off the timeout sequentially
5252
MAX_TIMEOUT = 500
5353

5454

55-
@backoff.on_exception(wait_gen=lambda : iter([100, 250, 300, MAX_TIMEOUT]), exception=Exception, max_tries=5, on_backoff=on_backoff)
55+
@backoff.on_exception(
56+
wait_gen=lambda: (wait_time for wait_time in [100, 250, 300, MAX_TIMEOUT]),
57+
exception=Exception,
58+
max_tries=5,
59+
on_backoff=on_backoff,
60+
)
5661
def test_batch_translate_text_with_glossary(capsys, bucket):
5762

5863
translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
5964
"gs://cloud-samples-data/translation/text_with_glossary.txt",
6065
"gs://{}/translation/BATCH_TRANSLATION_GLOS_OUTPUT/".format(bucket.name),
6166
PROJECT_ID,
6267
GLOSSARY_ID,
63-
MAX_TIMEOUT)
68+
MAX_TIMEOUT,
69+
)
6470

6571
out, _ = capsys.readouterr()
6672
assert "Total Characters: 9" in out

0 commit comments

Comments
 (0)