Files
synapse/tests/__init__.py
Matthew Hodgson 486c6d3ce2 ⏺ Down from 136 to 106! The key achievement: the database layer is now on NativeConnectionPool and get_success drives asyncio via loop.run_until_complete. This means asyncio.get_running_loop() works inside coroutines driven by
get_success, enabling all native asyncio primitives.

  The remaining 106 defer.* calls are in:
  - async_helpers.py (old ObservableDeferred, gather_results functions that still use Deferreds)
  - Cache layer (deferred_cache.py, descriptors.py)
  - HTTP client/server (Twisted Protocol)
  - Context.py Twisted fallback paths (now dead code since HAS_TWISTED = False)
2026-03-22 00:23:58 +00:00

31 lines
1.0 KiB
Python

#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
# Copyright 2014-2016 OpenMarket Ltd
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# See the GNU Affero General Public License for more details:
# <https://www.gnu.org/licenses/agpl-3.0.html>.
#
# Originally licensed under the Apache License, Version 2.0:
# <http://www.apache.org/licenses/LICENSE-2.0>.
#
# [This file includes modifications made by New Vector Limited]
#
#
# Set up an asyncio event loop for tests.
import asyncio as _asyncio
import nest_asyncio as _nest_asyncio
_test_asyncio_loop = _asyncio.new_event_loop()
_asyncio.set_event_loop(_test_asyncio_loop)
# Allow nested event loop calls (run_until_complete inside run_until_complete)
_nest_asyncio.apply(_test_asyncio_loop)