From 13a668636956e42cc194274cf1a8ae7487056dc7 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Thu, 15 Apr 2021 16:28:00 +0200 Subject: [PATCH] test: fix flaky test for blocking pull shutdown (#378) If a test is run in a suite with other system tests, the messages are not always published in batch sizes as desired, which can affect how ACKs are handled on the backend (the server requires all messages published in a single batch to be ACK-ed in order to accept the ACKs). If a publisher client instance is shared between the tests, the batching can apparently be affected, thus we create a new client instance before each test. Since these tests are slow system tests, the overhead should not be significant. --- tests/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system.py b/tests/system.py index 181632d79..8ef3dca9f 100644 --- a/tests/system.py +++ b/tests/system.py @@ -44,12 +44,12 @@ def project(): yield default_project -@pytest.fixture(scope="module") +@pytest.fixture() def publisher(): yield pubsub_v1.PublisherClient() -@pytest.fixture(scope="module") +@pytest.fixture() def subscriber(): yield pubsub_v1.SubscriberClient()