Skip to content

Commit 9e5395f

Browse files
tobixenclaude
andcommitted
Support both old and new xandikos API in embedded test server
XandikosBackend was renamed to SingleUserFilesystemBackend in xandikos master (not yet released to PyPI). Try the new name first, fall back to the old name so both the PyPI release and git master work. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 95f85cc commit 9e5395f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/test_servers/embedded.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,13 @@ def start(self) -> None:
215215
return
216216

217217
try:
218-
from xandikos.web import SingleUserFilesystemBackend, XandikosApp
218+
from xandikos.web import XandikosApp
219+
220+
try:
221+
# xandikos master renamed XandikosBackend to SingleUserFilesystemBackend
222+
from xandikos.web import SingleUserFilesystemBackend as XandikosBackend
223+
except ImportError:
224+
from xandikos.web import XandikosBackend # type: ignore[no-redef]
219225
except ImportError as e:
220226
raise RuntimeError("Xandikos is not installed") from e
221227

@@ -228,7 +234,7 @@ def start(self) -> None:
228234
self.serverdir.__enter__()
229235

230236
# Create backend and configure principal (following conf.py pattern)
231-
backend = SingleUserFilesystemBackend(self.serverdir.name)
237+
backend = XandikosBackend(self.serverdir.name)
232238
backend._mark_as_principal(f"/{self.username}/")
233239
backend.create_principal(f"/{self.username}/", create_defaults=True)
234240

0 commit comments

Comments
 (0)