Skip to content

Commit

Permalink
Make server config management generic
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Sep 24, 2015
1 parent 0d3e274 commit 63cf4d8
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
universal = 1

[pytest]
norecursedirs = tests/storage/dav/servers/*
norecursedirs = tests/storage/servers/*

[flake8]
# W503: Line break before operator
Expand Down
6 changes: 6 additions & 0 deletions tests/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 2 additions & 9 deletions tests/storage/dav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions tests/storage/servers/baikal
1 change: 1 addition & 0 deletions tests/storage/servers/cozy
1 change: 1 addition & 0 deletions tests/storage/servers/fastmail
1 change: 1 addition & 0 deletions tests/storage/servers/icloud
1 change: 1 addition & 0 deletions tests/storage/servers/owncloud
File renamed without changes.
File renamed without changes.

0 comments on commit 63cf4d8

Please sign in to comment.