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

chore: remove gcp-devrel-py-tools from iot and pubsub #3470

Merged
merged 2 commits into from
Apr 23, 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
3 changes: 2 additions & 1 deletion iot/api-client/mqtt_example/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest==5.3.2
backoff==1.10.0
flaky==3.6.1
pytest==5.3.2
2 changes: 0 additions & 2 deletions iot/api-client/mqtt_example/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 13 additions & 7 deletions pubsub/cloud-client/publisher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions pubsub/cloud-client/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -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
32 changes: 21 additions & 11 deletions pubsub/cloud-client/subscriber_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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)
Expand All @@ -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):
Expand Down