python-caldav / caldav

Apache License 2.0
333 stars 98 forks source link

Make a `server()`-function in tests/conf.py for usage by examples etc #90

Open tobixen opened 4 years ago

tobixen commented 4 years ago

Currently the test code will repeatedly spawn xandikos and radicale server instances (if those are installed) and run tests towards them. This works great as long as one is sticking to one python version - but i.e. legacy python2-support is impossible this way (I would like the caldav library versions 0.x to work under python2, and eventually drop python2-support when releasing 1.x, then it's important that it's easy to test it under python2), and if one wants to test for other python3-version it's also difficult as radicale and xandikos has to be installed separately for each and every python version.

So, the plan is:

1) Fix a spawn_test_servers.py that will spawn up different calendar servers. It should read from the test config to see what servers to spawn and what ports to use.

2) In the test code, before attempting to spawn up xandikos or radicale, check if the port is already open. If it's open, assume xandikos and radicale is already running on the "outside" of the test suite.

3) Somehow, add support for more (non-python) calendar servers i spawn_test_servers.py (possibly by using container technology).

4) Fix some CI solution (i.e. travis) so that this happens automatically when pushing new commits and pull requests (see also #61)

tobixen commented 3 years ago

By now there is a client()-function in tests.conf to set up a DAVClient object. I think probably it could be a good idea to create a server()-function there as well to create some server.

tobixen commented 2 years ago

Python2 is not officially supported anymore, and multiple python versions are tested towards radicale and xandikos at every commit, so this one is sort of moot ... except possibly for usage by scripts under the examples folder.

At least with Xandikos it should be trivial, AFAIR jelmer made some hooks for this in the code.

I'll let it stay open for a while.