summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-11-01 13:07:54 +0000
committerDavid Robertson <davidr@element.io>2022-11-03 21:37:17 +0000
commit2e2cffe1a27c2d819ab7eec188a4a7c4f64dabcc (patch)
treed445071b9a4650300fd49e6790deaa95b09f4cec /tests
parentUpdate legacy `synapse_admin_mau:` metric names in docs (#14358) (diff)
downloadsynapse-2e2cffe1a27c2d819ab7eec188a4a7c4f64dabcc.tar.xz
Cherry-pick "Run trial tests against Python 3.11 (#13812)" and fixup commit
4f5d492cd6a9438de03d1b768f4c220cb662ac06

The release branch CI is failing because poetry seems unable to install
wrapt 1.13.3 when run under CPython 3.11. Develop has already bumped
wrapt for 3.11 compatibility. Cherry-pick that commit here to try and
get CI going again.
Diffstat (limited to 'tests')
-rw-r--r--tests/federation/transport/test_client.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/federation/transport/test_client.py b/tests/federation/transport/test_client.py
index dd4d1b56de..b84c74fc0e 100644
--- a/tests/federation/transport/test_client.py
+++ b/tests/federation/transport/test_client.py
@@ -15,6 +15,8 @@
 import json
 from unittest.mock import Mock
 
+import ijson.common
+
 from synapse.api.room_versions import RoomVersions
 from synapse.federation.transport.client import SendJoinParser
 from synapse.util import ExceptionBundle
@@ -117,8 +119,17 @@ class SendJoinParserTestCase(TestCase):
         coro_3 = Mock()
         coro_3.close = Mock(side_effect=RuntimeError("Couldn't close coro 3"))
 
+        original_coros = parser._coros
         parser._coros = [coro_1, coro_2, coro_3]
 
+        # Close the original coroutines. If we don't, when we garbage collect them
+        # they will throw, failing the test. (Oddly, this only started in CPython 3.11).
+        for coro in original_coros:
+            try:
+                coro.close()
+            except ijson.common.IncompleteJSONError:
+                pass
+
         # Send half of the data to the parser
         parser.write(serialisation[: len(serialisation) // 2])