Skip to content

Commit 31c86fd

Browse files
tobixenclaude
andcommitted
Fix CCS (Apple CalendarServer) test failures
- Add CCS compatibility hints: save.duplicate-uid.cross-calendar and save-load.todo.recurrences.thisandfuture as unsupported - Add old-dates skip checks to 4 search tests that use hardcoded dates older than CCS min-date-time allows (~1 year) - Use separate calendar ID for VTODO-only calendars in _fixCalendar_ to avoid reusing a VEVENT-only calendar on servers with wipe-calendar cleanup regime - Update teardown to clean up the -tasks calendar variant CCS tests now: 40 passed, 15 skipped, 0 failed (was 7 failures). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 43e1685 commit 31c86fd

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

caldav/compatibility_hints.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,10 @@ def dotted_feature_set_list(self, compact=False):
12771277
ccs = {
12781278
"save-load.journal": {"support": "unsupported"},
12791279
"save-load.todo.mixed-calendar": {"support": "unsupported"},
1280+
# CCS enforces unique UIDs across ALL calendars for a user
1281+
"save.duplicate-uid.cross-calendar": {"support": "unsupported"},
1282+
# CCS rejects multi-instance VTODOs (thisandfuture recurring completion)
1283+
"save-load.todo.recurrences.thisandfuture": {"support": "unsupported"},
12801284
"search.time-range.event": {"support": "full"},
12811285
"search.time-range.event.old-dates": {"support": "ungraceful"},
12821286
"search.time-range.todo": {"support": "full"},

tests/test_caldav.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,17 @@ def _cleanup(self, mode=None):
877877
cal.delete()
878878
if self.check_compatibility_flag("unique_calendar_ids") and mode == "pre":
879879
a = self._teardownCalendar(name="Yep")
880-
for calid in (self.testcal_id, self.testcal_id2):
880+
for calid in (self.testcal_id, self.testcal_id2, self.testcal_id + "-tasks"):
881881
self._teardownCalendar(cal_id=calid)
882882
if self.cleanup_regime == "thorough":
883-
for name in ("Yep", "Yapp", "Yølp", self.testcal_id, self.testcal_id2):
883+
for name in (
884+
"Yep",
885+
"Yapp",
886+
"Yølp",
887+
self.testcal_id,
888+
self.testcal_id2,
889+
self.testcal_id + "-tasks",
890+
):
884891
self._teardownCalendar(name=name)
885892
self._teardownCalendar(cal_id=name)
886893

@@ -945,7 +952,15 @@ def _fixCalendar_(self, **kwargs):
945952
else:
946953
kwargs["name"] = "Yep"
947954
if "cal_id" not in kwargs:
948-
kwargs["cal_id"] = self.testcal_id
955+
# Use a separate calendar for non-VEVENT component sets
956+
# (e.g. VTODO-only) to avoid reusing a VEVENT-only calendar
957+
# on servers where MKCALENDAR "already exists" falls through
958+
# to the existing calendar with the wrong component set.
959+
comp_set = kwargs.get("supported_calendar_component_set", [])
960+
if comp_set and "VEVENT" not in comp_set:
961+
kwargs["cal_id"] = self.testcal_id + "-tasks"
962+
else:
963+
kwargs["cal_id"] = self.testcal_id
949964
try:
950965
ret = self.principal.make_calendar(**kwargs)
951966
except (error.MkcalendarError, error.AuthorizationError):
@@ -1737,6 +1752,7 @@ def testGetSupportedComponents(self):
17371752
def testSearchEvent(self):
17381753
self.skip_unless_support("save-load.event")
17391754
self.skip_unless_support("search")
1755+
self.skip_unless_support("search.time-range.event.old-dates")
17401756
c = self._fixCalendar()
17411757

17421758
num_existing = len(c.get_events())
@@ -2564,6 +2580,7 @@ def testTodoDatesearch(self):
25642580
"""
25652581
self.skip_unless_support("save-load.todo")
25662582
self.skip_unless_support("search.time-range.todo")
2583+
self.skip_unless_support("search.time-range.todo.old-dates")
25672584
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
25682585

25692586
# add todo-item
@@ -3100,6 +3117,7 @@ def testDateSearchAndFreeBusy(self):
31003117
"""
31013118
self.skip_unless_support("save-load.event")
31023119
self.skip_unless_support("search")
3120+
self.skip_unless_support("search.time-range.event.old-dates")
31033121
# Create calendar, add event ...
31043122
c = self._fixCalendar()
31053123
assert c.url is not None
@@ -3292,6 +3310,7 @@ def testRecurringDateSearch(self):
32923310

32933311
def testRecurringDateWithExceptionSearch(self):
32943312
self.skip_unless_support("search")
3313+
self.skip_unless_support("search.time-range.event.old-dates")
32953314
c = self._fixCalendar()
32963315

32973316
# evr2 is a bi-weekly event starting 2024-04-11

0 commit comments

Comments
 (0)