Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Merged
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
23 changes: 23 additions & 0 deletions tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import six

import google.auth
from google.api_core import exceptions as core_exceptions
from google.cloud import pubsub_v1
from google.cloud.pubsub_v1 import exceptions
from google.cloud.pubsub_v1 import futures
Expand Down Expand Up @@ -432,6 +433,28 @@ def one_arg_close(subscriber): # the cleanup helper expects exactly one argumen
assert conn_count_end == conn_count_start


def test_synchronous_pull_no_deadline_error_if_no_messages(
publisher, topic_path, subscriber, subscription_path, cleanup
):
# Make sure the topic and subscription get deleted.
cleanup.append((publisher.delete_topic, topic_path))
cleanup.append((subscriber.delete_subscription, subscription_path))

# Create a topic and subscribe to it.
publisher.create_topic(topic_path)
subscriber.create_subscription(subscription_path, topic_path)

try:
response = subscriber.pull(subscription_path, max_messages=2)
except core_exceptions.DeadlineExceeded:
pytest.fail(
"Unexpected DeadlineExceeded error on synchronous pull when no "
"messages published to the topic."
)
else:
assert list(response.received_messages) == []


class TestStreamingPull(object):
def test_streaming_pull_callback_error_propagation(
self, publisher, topic_path, subscriber, subscription_path, cleanup
Expand Down