mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-02 19:16:12 -04:00
Run trial tests against Python 3.11 (#13812)
This commit is contained in:
parent
9473ebb9e7
commit
5905ba12d0
5 changed files with 149 additions and 97 deletions
|
@ -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])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue