synapse/tests
Erik Johnston b74c29f694
Move towards a dedicated Duration class (#19223)
We have various constants to try and avoid mistyping of durations, e.g.
`ONE_HOUR_SECONDS * MILLISECONDS_PER_SECOND`, however this can get a
little verbose and doesn't help with typing.

Instead, let's move towards a dedicated `Duration` class (basically a
[`timedelta`](https://docs.python.org/3/library/datetime.html#timedelta-objects)
with helper methods).

This PR introduces the new types and converts all usages of the existing
constants with it. Future PRs may work to move the clock methods to also
use it (e.g. `call_later` and `looping_call`).

Reviewable commit-by-commit.
2025-11-26 10:56:59 +00:00
..
api Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
app Fix lost logcontext on HomeServer.shutdown() (#19108) 2025-11-03 14:07:10 -06:00
appservice Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
config Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
crypto Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
events Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
federation Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
handlers Allow subpaths in MAS endpoints (#19186) 2025-11-18 18:45:33 +00:00
http Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
logging Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
media Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
metrics Move towards a dedicated Duration class (#19223) 2025-11-26 10:56:59 +00:00
module_api Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
push Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
replication Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
rest Move towards a dedicated Duration class (#19223) 2025-11-26 10:56:59 +00:00
scripts Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
server_notices Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
state Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
storage Move towards a dedicated Duration class (#19223) 2025-11-26 10:56:59 +00:00
synapse_rust Wrap the Rust HTTP client with make_deferred_yieldable (#18903) 2025-10-02 13:00:50 -05:00
test_utils Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
types Support for room version 12 2025-08-11 16:43:45 +01:00
util Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
server.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_distributor.py Cleanly shutdown SynapseHomeServer object (#18828) 2025-10-01 02:42:09 +00:00
test_event_auth.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_mau.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_phone_home.py Move unique snowflake homeserver background tasks to start_background_tasks (#19037) 2025-10-13 10:19:09 -05:00
test_rust.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_server.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_state.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_terms_auth.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_types.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_visibility.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
unittest.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
utils.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00