diff --git a/.gitignore b/.gitignore index 50e5c1d..7e0efb4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ htmlcov build env owncloud-testserver +*.egg-info diff --git a/.travis.yml b/.travis.yml index 7f15f3e..dcae517 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ language: python python: "2.7" env: - - DAV_SERVER=radicale RADICALE_STORAGE=filesystem - - DAV_SERVER=radicale RADICALE_STORAGE=database - - DAV_SERVER=radicale_git RADICALE_STORAGE=filesystem - - DAV_SERVER=radicale_git RADICALE_STORAGE=database - - DAV_SERVER=owncloud + global: + - IS_TRAVIS=true + matrix: + - DAV_SERVER=radicale_filesystem REQUIREMENTS=release + - DAV_SERVER=radicale_filesystem REQUIREMENTS=devel + - DAV_SERVER=radicale_database REQUIREMENTS=release + - DAV_SERVER=radicale_database REQUIREMENTS=devel + - DAV_SERVER=owncloud REQUIREMENTS=release install: "./install-deps.sh" script: "./run-tests.sh tests/" diff --git a/install-deps.sh b/install-deps.sh index 9ee8ddb..f570be5 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -1,28 +1,30 @@ #!/bin/sh -pip install --use-mirrors . +echo "The shell is $SHELL" +set -e +pip install --use-mirrors --editable . pip install --use-mirrors -r requirements.txt -[[ -z "$DAV_SERVER" ]] && DAV_SERVER=radicale -[[ -z "$RADICALE_STORAGE" ]] && RADICALE_STORAGE=filesystem +[ -n "$DAV_SERVER" ] || DAV_SERVER=radicale_filesystem -davserver_radicale() { - pip install --use-mirrors radicale +davserver_radicale_filesystem() { radicale_deps } -davserver_radicale_git() { - pip install git+https://github.com/Kozea/Radicale.git +davserver_radicale_database() { radicale_deps + pip install --use-mirrors sqlalchemy pysqlite } radicale_deps() { - pip install --use-mirrors werkzeug - radicale_storage_$RADICALE_STORAGE + if [ "$REQUIREMENTS" == "release" ]; then + radicale_pkg="radicale" + elif [ "$REQUIREMENTS" == "devel" ]; then + radicale_pkg="git+https://github.com/Kozea/Radicale.git" + else + false + fi + pip install --use-mirrors werkzeug $radicale_pkg } -radicale_storage_database() { pip install --use-mirrors sqlalchemy pysqlite; } -radicale_storage_filesystem() { true; } - - davserver_owncloud() { git clone https://github.com/untitaker/owncloud-testserver.git cd ./owncloud-testserver/ diff --git a/run-tests.sh b/run-tests.sh old mode 100644 new mode 100755 index fb3f78d..515772a --- a/run-tests.sh +++ b/run-tests.sh @@ -1,12 +1,12 @@ #!/bin/sh -[[ -z "$DAV_SERVER" ]] && DAV_SERVER=radicale -[[ -z "$RADICALE_STORAGE" ]] && RADICALE_STORAGE=filesystem +set -e +[ -n "$DAV_SERVER" ] || DAV_SERVER=radicale_filesystem -davserver_radicale() { true; } -davserver_radicale_git() { true; } +davserver_radicale_database() { true; } +davserver_radicale_filesystem() { true; } davserver_owncloud() { - sh ./owncloud-testserver/php.sh + sh ./owncloud-testserver/php.sh > /dev/null } diff --git a/tests/storage/dav/__init__.py b/tests/storage/dav/__init__.py index e8a31bb..33c8417 100644 --- a/tests/storage/dav/__init__.py +++ b/tests/storage/dav/__init__.py @@ -17,7 +17,7 @@ import requests.exceptions dav_server = os.environ.get('DAV_SERVER', '').strip() or 'radicale' -if dav_server in ('radicale', 'radicale_git'): +if dav_server.startswith('radicale_'): from ._radicale import ServerMixin elif dav_server == 'owncloud': from ._owncloud import ServerMixin diff --git a/tests/storage/dav/_radicale.py b/tests/storage/dav/_radicale.py index d10a022..7aea147 100644 --- a/tests/storage/dav/_radicale.py +++ b/tests/storage/dav/_radicale.py @@ -57,6 +57,8 @@ create table property ( primary key (name, collection_path)); ''' +dav_server = os.environ.get('DAV_SERVER', 'radicale_filesystem') + def do_the_radicale_dance(tmpdir): # All of radicale is already global state, the cleanliness of the code and @@ -75,7 +77,7 @@ def do_the_radicale_dance(tmpdir): # Now we can set some basic configuration. radicale.config.set('rights', 'type', 'None') - if os.environ.get('RADICALE_STORAGE', 'filesystem') == 'filesystem': + if dav_server == 'radicale_filesystem': radicale.config.set('storage', 'type', 'filesystem') radicale.config.set('storage', 'filesystem_folder', tmpdir) else: