Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mark few tests as flaky
that involves LRO polling.
  • Loading branch information
Takashi Matsuo
Takashi Matsuo committed Apr 24, 2020
commit 186c17d43b6ecd5bb1f1e5503d70e57ba60818d4
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def bucket():
bucket.delete(force=True)


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_batch_translate_text(capsys, bucket):
translate_v3_batch_translate_text.batch_translate_text(
"gs://cloud-samples-data/translation/text.txt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def bucket():
bucket.delete(force=True)


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_batch_translate_text_with_glossary(capsys, bucket, glossary):
translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
"gs://cloud-samples-data/translation/text_with_glossary.txt",
Expand Down
29 changes: 16 additions & 13 deletions translate/cloud-client/translate_v3_create_glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@
GLOSSARY_INPUT_URI = "gs://cloud-samples-data/translation/glossary_ja.csv"


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_create_glossary(capsys):
glossary_id = "test-{}".format(uuid.uuid4())
translate_v3_create_glossary.create_glossary(
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
)
out, _ = capsys.readouterr()
# assert
assert "Created:" in out
assert "gs://cloud-samples-data/translation/glossary_ja.csv" in out

# clean up after use
try:
translate_v3_delete_glossary.delete_glossary(PROJECT_ID, glossary_id)
except Exception:
pass
glossary_id = "test-{}".format(uuid.uuid4())
translate_v3_create_glossary.create_glossary(
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
)
out, _ = capsys.readouterr()
# assert
assert "Created:" in out
assert "gs://cloud-samples-data/translation/glossary_ja.csv" in out
finally:
# clean up after use
try:
translate_v3_delete_glossary.delete_glossary(
PROJECT_ID, glossary_id)
except Exception:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
GLOSSARY_INPUT_URI = "gs://cloud-samples-data/translation/glossary_ja.csv"


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