Files
synapse/tests/__init__.py
Matthew Hodgson f266396e25 Here's the current state summary:
What's done:

  1. All Twisted imports conditional (230 files wrapped in try/except ImportError)
  2. Test base class: stdlib unittest.TestCase (no more twisted.trial)
  3. ContextVar is primary logcontext storage (threading.local removed)
  4. All @defer.inlineCallbacks converted to async def (0 remaining)
  5. Module API fully async (no Deferred return types)
  6. CancelledError is asyncio.CancelledError in 17 files
  7. yieldable_gather_results uses asyncio.gather (with Twisted fallback)
  8. run_in_background tries asyncio first (falls back to Twisted)
  9. Asyncio reactor installed in production (_base.py)
  10. Twisted optional in pyproject.toml
  11. All 21 key modules import without Twisted

  What remains:

  - ~79 defer.* calls in old utility classes (Linearizer, ReadWriteLock, etc.) and reactor entry points — these can only be removed when the test infrastructure switches from MemoryReactorClock to a real asyncio loop
  - 4 REST cancellation test failures (Twisted request lifecycle)
  - The reactor.run() → asyncio.run() entry point switch (production only, not tests)
2026-03-21 21:46:27 +00:00

23 lines
764 B
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]
#
#
# Test initialization — no Twisted patching needed