Skip to content

Commit

Permalink
chore: remove gcp-devrel-py-tools from iot and pubsub (#3470)
Browse files Browse the repository at this point in the history
* [iot] chore: remove unused dependency

* [pubsub] chore: remove gcp-devrel-py-tools
  • Loading branch information
Takashi Matsuo authored Apr 23, 2020
1 parent c02e993 commit 819e68e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 23 deletions.
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

0 comments on commit 819e68e

Please sign in to comment.