Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate: fix tests #3087

Merged
merged 4 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def batch_translate_text(
output_config=output_config)

print(u"Waiting for operation to complete...")
response = operation.result(90)
response = operation.result(180)

print(u"Total Characters: {}".format(response.total_characters))
print(u"Translated Characters: {}".format(response.translated_characters))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@pytest.fixture(scope="function")
def bucket():
"""Create a temporary bucket to store annotation output."""
bucket_name = str(uuid.uuid1())
bucket_name = "test-{}".format(uuid.uuid4())
storage_client = storage.Client()
bucket = storage_client.create_bucket(bucket_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def batch_translate_text_with_glossary(
)

print(u"Waiting for operation to complete...")
response = operation.result(120)
response = operation.result(180)

print(u"Total Characters: {}".format(response.total_characters))
print(u"Translated Characters: {}".format(response.translated_characters))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@pytest.fixture(scope="session")
def glossary():
"""Get the ID of a glossary available to session (do not mutate/delete)."""
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
glossary_id = "test-{}".format(uuid.uuid4())
translate_v3_create_glossary.create_glossary(
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
)
Expand Down
2 changes: 1 addition & 1 deletion translate/cloud-client/translate_v3_create_glossary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create_glossary(
# to translate the domain-specific terminology.
operation = client.create_glossary(parent=parent, glossary=glossary)

result = operation.result(timeout=90)
result = operation.result(timeout=180)
print("Created: {}".format(result.name))
print("Input Uri: {}".format(result.input_config.gcs_source.input_uri))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def test_create_glossary(capsys):
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
glossary_id = "test-{}".format(uuid.uuid4())
translate_v3_create_glossary.create_glossary(
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
)
Expand Down
2 changes: 1 addition & 1 deletion translate/cloud-client/translate_v3_delete_glossary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def delete_glossary(
parent = client.glossary_path(project_id, "us-central1", glossary_id)

operation = client.delete_glossary(parent)
result = operation.result(timeout=90)
result = operation.result(timeout=180)
print("Deleted: {}".format(result.name))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

def test_delete_glossary(capsys):
# setup
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
glossary_id = "test-{}".format(uuid.uuid4())
translate_v3_create_glossary.create_glossary(
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
)
Expand Down