Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Resolve connections deprecation warning #1310

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ filterwarnings =
# Remove once the minimum supported version of googleapis-common-protos is 1.62.0
ignore:.*pkg_resources.declare_namespace:DeprecationWarning
ignore:.*pkg_resources is deprecated as an API:DeprecationWarning
# Remove once https://github.com/googleapis/python-pubsub/issues/1206 is fixed.
ignore:.*connections\(\) is deprecated and will be removed; use net_connections\(\) instead:DeprecationWarning
4 changes: 2 additions & 2 deletions tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def test_subscriber_not_leaking_open_sockets(
publisher.create_topic(name=topic_path)

current_process = psutil.Process()
conn_count_start = len(current_process.connections())
conn_count_start = len(current_process.net_connections())

# Publish a few messages, then synchronously pull them and check that
# no sockets are leaked.
Expand All @@ -487,7 +487,7 @@ def test_subscriber_not_leaking_open_sockets(
response = subscriber.pull(subscription=subscription_path, max_messages=3)
assert len(response.received_messages) == 3

conn_count_end = len(current_process.connections())
conn_count_end = len(current_process.net_connections())

# To avoid flakiness, use <= in the assertion, since on rare occasions additional
# sockets are closed, causing the == assertion to fail.
Expand Down
Loading