Skip to content

Commit fc7aa14

Browse files
committed
attempt 2
1 parent 07d4852 commit fc7aa14

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/asynchronous/test_monitor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ async def test_cleanup_executors_on_client_del(self):
7777

7878
def resource_warning_caught():
7979
for warning in w:
80-
if isinstance(warning.message, ResourceWarning):
80+
if (
81+
issubclass(warning.category, ResourceWarning)
82+
and "Call AsyncMongoClient.close() to safely shut down your client and free up resources."
83+
in str(warning.message)
84+
):
8185
return True
8286
return False
8387

test/test_monitor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def test_cleanup_executors_on_client_del(self):
7575

7676
def resource_warning_caught():
7777
for warning in w:
78-
if isinstance(warning.message, ResourceWarning):
78+
if (
79+
issubclass(warning.category, ResourceWarning)
80+
and "Call MongoClient.close() to safely shut down your client and free up resources."
81+
in str(warning.message)
82+
):
7983
return True
8084
return False
8185

0 commit comments

Comments
 (0)