Skip to content

Commit d47fb0f

Browse files
Jon Wayne Parrottplamut
Jon Wayne Parrott
authored andcommitted
Fix pubusb tests
Change-Id: I7dfe60b0f1240dc58a664968fd97ca5a8fa1109d
1 parent fdee3c4 commit d47fb0f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

samples/snippets/iam_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@
2121
TEST_SUBSCRIPTION = 'iam-test-subscription'
2222

2323

24-
@pytest.fixture
24+
@pytest.fixture(scope='module')
2525
def test_topic():
2626
client = pubsub.Client()
2727
topic = client.topic(TEST_TOPIC)
28-
topic.create()
28+
29+
if not topic.exists():
30+
topic.create()
31+
2932
yield topic
33+
3034
if topic.exists():
3135
topic.delete()
3236

samples/snippets/subscriber_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222
TEST_SUBSCRIPTION = 'subscription-test-subscription'
2323

2424

25-
@pytest.fixture
25+
@pytest.fixture(scope='module')
2626
def test_topic():
2727
client = pubsub.Client()
2828
topic = client.topic(TEST_TOPIC)
29-
topic.create()
29+
30+
if not topic.exists():
31+
topic.create()
32+
3033
yield topic
34+
3135
if topic.exists():
3236
topic.delete()
3337

0 commit comments

Comments
 (0)