Skip to content

Commit 186c17d

Browse files
author
Takashi Matsuo
committed
mark few tests as flaky
that involves LRO polling.
1 parent e4f710f commit 186c17d

4 files changed

+19
-13
lines changed

translate/cloud-client/translate_v3_batch_translate_text_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def bucket():
3333
bucket.delete(force=True)
3434

3535

36+
@pytest.mark.flaky(max_runs=3, min_passes=1)
3637
def test_batch_translate_text(capsys, bucket):
3738
translate_v3_batch_translate_text.batch_translate_text(
3839
"gs://cloud-samples-data/translation/text.txt",

translate/cloud-client/translate_v3_batch_translate_text_with_glossary_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def bucket():
5252
bucket.delete(force=True)
5353

5454

55+
@pytest.mark.flaky(max_runs=3, min_passes=1)
5556
def test_batch_translate_text_with_glossary(capsys, bucket, glossary):
5657
translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
5758
"gs://cloud-samples-data/translation/text_with_glossary.txt",

translate/cloud-client/translate_v3_create_glossary_test.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@
2121
GLOSSARY_INPUT_URI = "gs://cloud-samples-data/translation/glossary_ja.csv"
2222

2323

24+
@pytest.mark.flaky(max_runs=3, min_passes=1)
2425
def test_create_glossary(capsys):
25-
glossary_id = "test-{}".format(uuid.uuid4())
26-
translate_v3_create_glossary.create_glossary(
27-
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
28-
)
29-
out, _ = capsys.readouterr()
30-
# assert
31-
assert "Created:" in out
32-
assert "gs://cloud-samples-data/translation/glossary_ja.csv" in out
33-
34-
# clean up after use
3526
try:
36-
translate_v3_delete_glossary.delete_glossary(PROJECT_ID, glossary_id)
37-
except Exception:
38-
pass
27+
glossary_id = "test-{}".format(uuid.uuid4())
28+
translate_v3_create_glossary.create_glossary(
29+
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
30+
)
31+
out, _ = capsys.readouterr()
32+
# assert
33+
assert "Created:" in out
34+
assert "gs://cloud-samples-data/translation/glossary_ja.csv" in out
35+
finally:
36+
# clean up after use
37+
try:
38+
translate_v3_delete_glossary.delete_glossary(
39+
PROJECT_ID, glossary_id)
40+
except Exception:
41+
pass

translate/cloud-client/translate_v3_delete_glossary_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
GLOSSARY_INPUT_URI = "gs://cloud-samples-data/translation/glossary_ja.csv"
2222

2323

24+
@pytest.mark.flaky(max_runs=3, min_passes=1)
2425
def test_delete_glossary(capsys):
2526
# setup
2627
glossary_id = "test-{}".format(uuid.uuid4())

0 commit comments

Comments
 (0)