You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a2688ae
Browse filesBrowse the repository at this point in the historyBrowse files
feat: ship the test-server registry in the package
The caldav source code has rather a lot of testing logic, including
allowing ordinary configuration files to enable testing towards the
configured servers, allowing special test server configuration files to
be read, and also start/stop-scripts that can instantiate docker test
servers if docker or podman is installed.
There is a legitimate need for testing other packages (like plann, calendar-cli, calendaring, calendaring-sync) towards a wide range of test servers, hence we're bringing the test server registry logic out as a public part of the package. Arguably it would better belong in a separate package (or in the caldav-server-tester package). As for now the costs of spawning Yet Another Package have been considered bigger than the costs of adding some few kilobytes of pure-Python logic that ordinary users of the caldav package do not need - but this may be considered in the future - filed as #823
The registry, config loader, locks and the embedded, Docker and
external server classes moved from tests/test_servers into the
installed caldav.testing package, so other projects can use them
without a source checkout. tests/test_servers re-exports them, with
each submodule aliased to its new home so existing imports and
monkeypatching keep working. The docker-compose files stay in the
repository; CALDAV_DOCKER_TEST_SERVERS_DIR names them when caldav is
installed rather than checked out.
get_davclient() on a test server now uses that registry on an
installed caldav too, in place of the embedded-plus-test_allowed
fallback; a config file named explicitly or through
CALDAV_CONFIG_FILE still adds its test_allowed sections.
#817
Prompt: The other session reports that #817, closed by #820, has only been partially done. Please investigate [#817: move the test-server registry into the installed caldav.testing; #820 merged only the follow-up comment]
Followup-Prompt: Please just start working on a new PR instead [rather than commenting on #817]
Prompts (comments made inline in the document while reviewing it):
> (on this commit message, after rewriting its first paragraphs) Please do another QA of my editing here
Assisted-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
The test-server framework - `ServerRegistry`, `get_registry()`, the config loader and the Docker and external server classes - is now part of the installed package, as submodules of `caldav.testing`, so other projects can run their tests against caldav's test servers without a source checkout (https://github.com/python-caldav/caldav/issues/817). `tests/test_servers` re-exports it. The docker-compose files stay in the repository: set `CALDAV_DOCKER_TEST_SERVERS_DIR` to `tests/docker-test-servers` of a checkout to start the Docker servers from an installed caldav. `get_davclient()` with `PYTHON_CALDAV_USE_TEST_SERVER=1` now picks from that registry on an installed caldav too, so the servers in `~/.config/caldav/test_servers.yaml` are candidates there as well.
Copy file name to clipboardExpand all lines: docs/design/TODO.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ A response whose `Content-Type` says XML but whose body is not XML (an HTML erro
42
42
43
43
## A waiting session-lock claim blocks other threads
44
44
45
-
`TestServer.claim_server()` in `tests/test_servers/base.py` polls for the flock (up to `PYTHON_CALDAV_TEST_SERVER_LOCK_TIMEOUT`, 30 minutes by default) while holding the module-wide `_session_locks_mutex`. A thread waiting for one busy server therefore blocks every other thread claiming a different server, which contradicts "runs against different servers proceed in parallel". Harmless for single-threaded pytest. Fix: hold the mutex only around the `_session_locks` checks and inserts, with a per-name lock against double claims. Found in the review of https://github.com/python-caldav/caldav/pull/776.
45
+
`TestServer.claim_server()` in `caldav/testing/base.py` polls for the flock (up to `PYTHON_CALDAV_TEST_SERVER_LOCK_TIMEOUT`, 30 minutes by default) while holding the module-wide `_session_locks_mutex`. A thread waiting for one busy server therefore blocks every other thread claiming a different server, which contradicts "runs against different servers proceed in parallel". Harmless for single-threaded pytest. Fix: hold the mutex only around the `_session_locks` checks and inserts, with a per-name lock against double claims. Found in the review of https://github.com/python-caldav/caldav/pull/776.
46
46
47
47
## calendar_multiget() fails on an async client
48
48
@@ -72,3 +72,7 @@ On Nextcloud a deleted calendar moves to the trashbin, keeps its cal_id occupied
72
72
The tests and the caldav-server-tester leave calendars behind, and on servers that cap the number of calendars per principal (ecloud, see above) that eventually blocks all creation. On 2026-10-23 ecloud held 15 empty calendars with bare-uuid cal_ids and the uuid as display name; which code made them was not found. Every calendar the tests or the tester create should carry a cal_id prefix, like the caldav-server-tester's `csc_` UIDs, so a cleanup step can delete leftovers safely - with the purge from the section above where the server has a trashbin.
73
73
* caldav tests: there is no common cal_id prefix on every calendar, and no sweep. Several tests create calendars by name only (`test_caldav.py` "CalConfigA"/"CalConfigB", "XandikosMetaCal"/"RadicaleMetaCal", `test_get_calendars_sections.py`, `test_examples.py`), so `make_calendar()` gives them a bare uuid. Give all of them a `pythoncaldav-test` prefixed cal_id and add a session-level sweep.
74
74
* caldav-server-tester: has `PROBE_CALENDAR_PREFIXES` and a sweep matching cal_id or display name, but `CheckDuplicateUID` creates its second calendar by name only, so its cal_id is a bare uuid that the sweep cannot recognise when the server drops the display name. Pass a prefixed cal_id. Its sweep also only moves calendars to the Nextcloud trashbin.
75
+
76
+
## An installed caldav.testing looks for the checkout in site-packages
77
+
78
+
`caldav/testing/config_loader.py` (`_TESTS_DIR`) and `docker_servers_dir()` in `caldav/testing/base.py` look for a checkout's `tests/` three levels up from the module. For an installed caldav that is `site-packages/tests`, so a stray top-level `tests` directory left by another badly packaged wheel would be searched for `caldav_test_servers.yaml` and `docker-test-servers/`. Also, while `CALDAV_DOCKER_TEST_SERVERS_DIR` locates the compose files of a checkout, nothing locates its `caldav_test_servers.yaml`, so an installed caldav reads only `~/.config/caldav/test_servers.yaml`. Fix: use the `tests/` path only when it belongs to a caldav checkout (e.g. a sibling `pyproject.toml` naming caldav), and perhaps add a `CALDAV_TEST_SERVERS_CONFIG` variable. Found in the review of https://github.com/python-caldav/caldav/issues/817.
0 commit comments