From e74677b7ce04242d1636cc070777f7502c2a4978 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Mon, 12 Apr 2021 10:43:21 +0200 Subject: [PATCH] test: fix flaky test for blocking pull shutdown 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()