Skip to content

Commit 1853a9b

Browse files
committed
Ignore ResourceWarning in test.
This is expected to prevent a spurious test failure under PyPy. Refs #1483.
1 parent 9ec785d commit 1853a9b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/legacy/utils.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import contextlib
33
import functools
44
import logging
5+
import sys
56
import unittest
67

78

@@ -76,8 +77,19 @@ def assertDeprecationWarnings(self, recorded_warnings, expected_warnings):
7677
Check recorded deprecation warnings match a list of expected messages.
7778
7879
"""
80+
# Work around https://github.com/python/cpython/issues/90476.
81+
if sys.version_info[:2] < (3, 11): # pragma: no cover
82+
recorded_warnings = [
83+
recorded
84+
for recorded in recorded_warnings
85+
if not (
86+
type(recorded.message) is ResourceWarning
87+
and str(recorded.message).startswith("unclosed transport")
88+
)
89+
]
90+
7991
for recorded in recorded_warnings:
80-
self.assertEqual(type(recorded.message), DeprecationWarning)
92+
self.assertIs(type(recorded.message), DeprecationWarning)
8193
self.assertEqual(
8294
{str(recorded.message) for recorded in recorded_warnings},
8395
set(expected_warnings),

0 commit comments

Comments
 (0)