diff --git a/iot/api-client/mqtt_example/requirements-test.txt b/iot/api-client/mqtt_example/requirements-test.txt index 132ae92cb323..4e10a06cf965 100644 --- a/iot/api-client/mqtt_example/requirements-test.txt +++ b/iot/api-client/mqtt_example/requirements-test.txt @@ -1,2 +1,3 @@ -pytest==5.3.2 backoff==1.10.0 +flaky==3.6.1 +pytest==5.3.2 diff --git a/iot/api-client/mqtt_example/requirements.txt b/iot/api-client/mqtt_example/requirements.txt index 2805ace20792..66877c572e70 100644 --- a/iot/api-client/mqtt_example/requirements.txt +++ b/iot/api-client/mqtt_example/requirements.txt @@ -1,6 +1,4 @@ cryptography==2.9.1 -flaky==3.6.1 -gcp-devrel-py-tools==0.0.15 google-api-python-client==1.8.0 google-auth-httplib2==0.0.3 google-auth==1.14.0 diff --git a/pubsub/cloud-client/publisher_test.py b/pubsub/cloud-client/publisher_test.py index aa55011c190d..dc6095508112 100644 --- a/pubsub/cloud-client/publisher_test.py +++ b/pubsub/cloud-client/publisher_test.py @@ -16,7 +16,7 @@ import time import uuid -from gcp_devrel.testing import eventually_consistent +import backoff from google.cloud import pubsub_v1 import mock import pytest @@ -75,12 +75,14 @@ def new_sleep(period): def test_list(client, topic_admin, capsys): - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): publisher.list_topics(PROJECT) out, _ = capsys.readouterr() assert topic_admin in out + eventually_consistent_test() + def test_create(client): topic_path = client.topic_path(PROJECT, TOPIC_ADMIN) @@ -91,19 +93,23 @@ def test_create(client): publisher.create_topic(PROJECT, TOPIC_ADMIN) - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): assert client.get_topic(topic_path) + eventually_consistent_test() + def test_delete(client, topic_admin): publisher.delete_topic(PROJECT, TOPIC_ADMIN) - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): with pytest.raises(Exception): client.get_topic(client.topic_path(PROJECT, TOPIC_ADMIN)) + eventually_consistent_test() + def test_publish(topic_publish, capsys): publisher.publish_messages(PROJECT, TOPIC_PUBLISH) diff --git a/pubsub/cloud-client/requirements-test.txt b/pubsub/cloud-client/requirements-test.txt index c445bcb1aecf..adf26b9f98bb 100644 --- a/pubsub/cloud-client/requirements-test.txt +++ b/pubsub/cloud-client/requirements-test.txt @@ -1,4 +1,3 @@ +backoff==1.10.0 pytest==5.3.2 -gcp-devrel-py-tools==0.0.15 mock==3.0.5 -google-cloud-core==1.3.0 diff --git a/pubsub/cloud-client/subscriber_test.py b/pubsub/cloud-client/subscriber_test.py index 94905d63525d..1c9520866f17 100644 --- a/pubsub/cloud-client/subscriber_test.py +++ b/pubsub/cloud-client/subscriber_test.py @@ -15,7 +15,7 @@ import os import uuid -from gcp_devrel.testing import eventually_consistent +import backoff from google.cloud import pubsub_v1 import pytest @@ -110,20 +110,24 @@ def subscription_async(subscriber_client, topic): def test_list_in_topic(subscription_admin, capsys): - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): subscriber.list_subscriptions_in_topic(PROJECT, TOPIC) out, _ = capsys.readouterr() assert subscription_admin in out + eventually_consistent_test() + def test_list_in_project(subscription_admin, capsys): - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): subscriber.list_subscriptions_in_project(PROJECT) out, _ = capsys.readouterr() assert subscription_admin in out + eventually_consistent_test() + def test_create(subscriber_client): subscription_path = subscriber_client.subscription_path( @@ -137,10 +141,12 @@ def test_create(subscriber_client): subscriber.create_subscription(PROJECT, TOPIC, SUBSCRIPTION_ADMIN) - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): assert subscriber_client.get_subscription(subscription_path) + eventually_consistent_test() + def test_create_push(subscriber_client): subscription_path = subscriber_client.subscription_path( @@ -155,10 +161,12 @@ def test_create_push(subscriber_client): PROJECT, TOPIC, SUBSCRIPTION_ADMIN, ENDPOINT ) - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): assert subscriber_client.get_subscription(subscription_path) + eventually_consistent_test() + def test_update(subscriber_client, subscription_admin, capsys): subscriber.update_subscription(PROJECT, SUBSCRIPTION_ADMIN, NEW_ENDPOINT) @@ -170,11 +178,13 @@ def test_update(subscriber_client, subscription_admin, capsys): def test_delete(subscriber_client, subscription_admin): subscriber.delete_subscription(PROJECT, SUBSCRIPTION_ADMIN) - @eventually_consistent.call - def _(): + @backoff.on_exception(backoff.expo, AssertionError, max_time=60) + def eventually_consistent_test(): with pytest.raises(Exception): subscriber_client.get_subscription(subscription_admin) + eventually_consistent_test() + def _publish_messages(publisher_client, topic): for n in range(5):