apache_beam.testing.pubsub_test_context module

class apache_beam.testing.pubsub_test_context.TestPubsubContext(project_id, dry_run=False)[source]

Bases: object

A highly advanced Pub/Sub resource lifecycle manager for Python integration tests. Implements cascading third-party subscription cleanup and selective graceful teardown for debugging on failures.

Includes a safety ‘dry_run’ switch for safe deployment and validation of resources. Any catastrophic leaks are handled independently by the global ‘stale_cleaner.py’.

register_topic(topic_path: str)[source]

Registers a topic to be monitored and deleted at the end.

register_subscription(subscription_path: str)[source]

Registers a subscription to be monitored and deleted at the end.