diff --git a/.gitignore b/.gitignore index 9db68b473..3fe0a3e8e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,9 @@ env .egg .xprocess dist -tests/storage/dav/servers/* -!tests/storage/dav/servers/__init__.py -!tests/storage/dav/servers/radicale -!tests/storage/dav/servers/skip +tests/storage/servers/* +!tests/storage/servers/__init__.py +!tests/storage/servers/radicale +!tests/storage/servers/skip docs/_build/ vdirsyncer/version.py diff --git a/MANIFEST.in b/MANIFEST.in index c0c177814..24ea06d95 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,9 +6,9 @@ include Makefile recursive-include docs * recursive-include tests * -prune tests/storage/dav/servers -recursive-include tests/storage/dav/servers/radicale * -recursive-include tests/storage/dav/servers/skip * +prune tests/storage/servers +recursive-include tests/storage/servers/radicale * +recursive-include tests/storage/servers/skip * prune docs/_build global-exclude *.py[cdo] __pycache__ *.so *.pyd diff --git a/Makefile b/Makefile index e5eda34c4..b74a56ef1 100644 --- a/Makefile +++ b/Makefile @@ -14,20 +14,22 @@ export DAV_SERVER := radicale export RADICALE_BACKEND := filesystem export REQUIREMENTS := release -export TESTSERVER_BASE := ./tests/storage/dav/servers/ +export TESTSERVER_BASE := ./tests/storage/servers/ export TRAVIS := false -install-davserver: - set -e; \ - if [ ! -d "$(TESTSERVER_BASE)$(DAV_SERVER)/" ]; then \ - git clone --depth=1 \ - https://github.com/vdirsyncer/$(DAV_SERVER)-testserver.git \ - /tmp/$(DAV_SERVER)-testserver; \ - ln -s /tmp/$(DAV_SERVER)-testserver $(TESTSERVER_BASE)$(DAV_SERVER); \ - fi - cd $(TESTSERVER_BASE)$(DAV_SERVER) && sh install.sh +install-servers: + set -ex; \ + for server in $(DAV_SERVER); do \ + if [ ! -d "$(TESTSERVER_BASE)$$server/" ]; then \ + git clone --depth=1 \ + https://github.com/vdirsyncer/$$server-testserver.git \ + /tmp/$$server-testserver; \ + ln -s /tmp/$$server-testserver $(TESTSERVER_BASE)$$server; \ + fi; \ + cd $(TESTSERVER_BASE)$$server && sh install.sh; \ + done -install-test: install-davserver +install-test: install-servers pip install pytest pytest-xprocess pytest-localserver [ $(TRAVIS) != "true" ] || pip install coverage coveralls diff --git a/setup.cfg b/setup.cfg index 686566f22..fcbeaf6e5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ universal = 1 [pytest] -norecursedirs = tests/storage/dav/servers/* +norecursedirs = tests/storage/servers/* [flake8] # W503: Line break before operator diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index 26a570a7b..722672261 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -12,6 +12,12 @@ assert_item_equals +def get_server_mixin(server_name): + from . import __name__ as base + x = __import__('{}.servers.{}'.format(base, server_name), fromlist=['']) + return x.ServerMixin + + def format_item(item_template, uid=None): # assert that special chars are handled correctly. r = random.random() diff --git a/tests/storage/dav/__init__.py b/tests/storage/dav/__init__.py index 76bba507b..3c2a8f4f9 100644 --- a/tests/storage/dav/__init__.py +++ b/tests/storage/dav/__init__.py @@ -10,18 +10,11 @@ import vdirsyncer.exceptions as exceptions from vdirsyncer.storage.base import Item -from .. import StorageTests +from .. import StorageTests, get_server_mixin dav_server = os.environ['DAV_SERVER'] - - -def _get_server_mixin(server_name): - from . import __name__ as base - x = __import__('{}.servers.{}'.format(base, server_name), fromlist=['']) - return x.ServerMixin - -ServerMixin = _get_server_mixin(dav_server) +ServerMixin = get_server_mixin(dav_server) class DavStorageTests(ServerMixin, StorageTests): diff --git a/tests/storage/dav/servers/__init__.py b/tests/storage/servers/__init__.py similarity index 100% rename from tests/storage/dav/servers/__init__.py rename to tests/storage/servers/__init__.py diff --git a/tests/storage/servers/baikal b/tests/storage/servers/baikal new file mode 120000 index 000000000..cee0d3864 --- /dev/null +++ b/tests/storage/servers/baikal @@ -0,0 +1 @@ +/home/untitaker/projects/baikal-testserver/ \ No newline at end of file diff --git a/tests/storage/servers/cozy b/tests/storage/servers/cozy new file mode 120000 index 000000000..29c263ba6 --- /dev/null +++ b/tests/storage/servers/cozy @@ -0,0 +1 @@ +/home/untitaker/projects/cozy-testserver/ \ No newline at end of file diff --git a/tests/storage/servers/fastmail b/tests/storage/servers/fastmail new file mode 120000 index 000000000..e3ce569ec --- /dev/null +++ b/tests/storage/servers/fastmail @@ -0,0 +1 @@ +/home/untitaker/projects/fastmail-testserver/ \ No newline at end of file diff --git a/tests/storage/servers/icloud b/tests/storage/servers/icloud new file mode 120000 index 000000000..49125dafe --- /dev/null +++ b/tests/storage/servers/icloud @@ -0,0 +1 @@ +/home/untitaker/projects/icloud-testserver/ \ No newline at end of file diff --git a/tests/storage/servers/owncloud b/tests/storage/servers/owncloud new file mode 120000 index 000000000..9aeb7ef2b --- /dev/null +++ b/tests/storage/servers/owncloud @@ -0,0 +1 @@ +/home/untitaker/projects/owncloud-testserver/ \ No newline at end of file diff --git a/tests/storage/dav/servers/radicale/__init__.py b/tests/storage/servers/radicale/__init__.py similarity index 100% rename from tests/storage/dav/servers/radicale/__init__.py rename to tests/storage/servers/radicale/__init__.py diff --git a/tests/storage/dav/servers/radicale/install.sh b/tests/storage/servers/radicale/install.sh similarity index 100% rename from tests/storage/dav/servers/radicale/install.sh rename to tests/storage/servers/radicale/install.sh diff --git a/tests/storage/dav/servers/skip/__init__.py b/tests/storage/servers/skip/__init__.py similarity index 100% rename from tests/storage/dav/servers/skip/__init__.py rename to tests/storage/servers/skip/__init__.py diff --git a/tests/storage/dav/servers/skip/install.sh b/tests/storage/servers/skip/install.sh similarity index 100% rename from tests/storage/dav/servers/skip/install.sh rename to tests/storage/servers/skip/install.sh