Skip to content

Commit f79d35a

Browse files
xionamsparthea
andauthored
tests: Resolve connections deprecation warning (#1310)
Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent d4cfc2d commit f79d35a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

pytest.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ filterwarnings =
1818
# Remove once the minimum supported version of googleapis-common-protos is 1.62.0
1919
ignore:.*pkg_resources.declare_namespace:DeprecationWarning
2020
ignore:.*pkg_resources is deprecated as an API:DeprecationWarning
21-
# Remove once https://github.com/googleapis/python-pubsub/issues/1206 is fixed.
22-
ignore:.*connections\(\) is deprecated and will be removed; use net_connections\(\) instead:DeprecationWarning

tests/system.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def test_subscriber_not_leaking_open_sockets(
468468
publisher.create_topic(name=topic_path)
469469

470470
current_process = psutil.Process()
471-
conn_count_start = len(current_process.connections())
471+
conn_count_start = len(current_process.net_connections())
472472

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

490-
conn_count_end = len(current_process.connections())
490+
conn_count_end = len(current_process.net_connections())
491491

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

0 commit comments

Comments
 (0)