From 7575fb21a76069aaee2bf5cabdb718dcb6ac9eb2 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sun, 26 Jul 2015 13:12:53 +0200 Subject: [PATCH] Remove build.sh for good --- .gitignore | 1 + .travis.yml | 6 ++- MANIFEST.in | 2 +- Makefile | 41 +++++++++++++-- build.sh | 58 ---------------------- tests/storage/dav/servers/skip/__init__.py | 7 +++ tests/storage/dav/servers/skip/install.sh | 1 + 7 files changed, 52 insertions(+), 64 deletions(-) delete mode 100755 build.sh create mode 100644 tests/storage/dav/servers/skip/__init__.py create mode 100755 tests/storage/dav/servers/skip/install.sh diff --git a/.gitignore b/.gitignore index e36962b..6931f53 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,6 @@ dist tests/storage/dav/servers/* !tests/storage/dav/servers/__init__.py !tests/storage/dav/servers/radicale +!tests/storage/dav/servers/skip docs/_build/ vdirsyncer/version.py diff --git a/.travis.yml b/.travis.yml index 002156b..fcdbaac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,9 @@ env: # flake8 with plugins install: - - "make install-$BUILD" + - "pip install -U pip" + - "pip install wheel" + - "make -e install-$BUILD" - '[ -z "$PKGS" ] || pip install $PKGS' script: - - "make $BUILD" + - "make -e $BUILD" diff --git a/MANIFEST.in b/MANIFEST.in index e689e75..a148f44 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ include AUTHORS.rst include CHANGELOG.rst include LICENSE include config.example -include build.sh +include Makefile recursive-include docs * recursive-include tests * diff --git a/Makefile b/Makefile index 7560bf3..2b08042 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,43 @@ -install-test: - sh build.sh install_tests +# Packagers who want to run the testsuite against an installed vdirsyncer: +# +# - Create a virtualenv +# - Somehow link your installation of vdirsyncer into the virtualenv, e.g. by +# using --system-site-packages when creating the virtualenv +# - Inside the virtualenv: `make install-test test` +# +# The `install-test` target requires internet access. Be aware that vdirsyncer +# requires very recent versions of Radicale for the tests to run successfully. +# +# If you want to skip the DAV tests against Radicale, use: +# make DAV_SERVER=skip # ... + +DAV_SERVER = radicale +REQUIREMENTS = release +TESTSERVER_BASE = ./tests/storage/dav/servers/ +TRAVIS = false +PIP_INSTALL = pip install + +install-davserver: + 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-test: install-davserver + $(PIP_INSTALL) pytest pytest-xprocess pytest-localserver + [ $(TRAVIS) != "true" ] || $(PIP_INSTALL) coverage coveralls + $(PIP_INSTALL) -e . test: - sh build.sh tests + if [ "$(TRAVIS)" = "true" ]; then \ + coverage run --source=vdirsyncer/ --module pytest; \ + coveralls; \ + else \ + py.test; \ + fi install-style: pip install flake8 flake8-import-order sphinx diff --git a/build.sh b/build.sh deleted file mode 100755 index 224f492..0000000 --- a/build.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -set -e - -[ -n "$DAV_SERVER" ] || DAV_SERVER=radicale -[ -n "$REQUIREMENTS" ] || REQUIREMENTS=release -[ -n "$PIP_INSTALL" ] || PIP_INSTALL="pip install" -[ -n "$TESTSERVER_BASE" ] || TESTSERVER_BASE=./tests/storage/dav/servers/ - - -_optimize_pip() { - # Optimize pip for packages with many C extensions. Comes with its own - # cost, e.g. not worth it when running a style checker. - - if [ "$TRAVIS" = "true" ]; then - export CFLAGS=-O0 # speed up builds of packages which don't have wheels - $PIP_INSTALL --upgrade pip - $PIP_INSTALL wheel - PIP_INSTALL="pip install --use-wheel --find-links=http://travis-wheels.unterwaditzer.net/wheels/" - fi -} - - -_davserver() { - # Maybe tmpfs is mounted on /tmp/, can't harm anyway. - if [ ! -d $TESTSERVER_BASE$1/ ]; then - git clone --depth=1 \ - https://github.com/vdirsyncer/$1-testserver.git \ - /tmp/$1-testserver - ln -s /tmp/$1-testserver $TESTSERVER_BASE$1 - fi - (cd $TESTSERVER_BASE$1 && sh install.sh) -} - -command__install_tests() { - $PIP_INSTALL pytest pytest-xprocess pytest-localserver - _optimize_pip - _davserver $DAV_SERVER - [ "$TRAVIS" != "true" ] || $PIP_INSTALL coverage coveralls - $PIP_INSTALL --editable . -} - -command__tests() { - if [ "$TRAVIS" = "true" ]; then - coverage run --source=vdirsyncer/ --module pytest - coveralls - else - py.test - fi -} - - -COMMAND="$1" -if [ -z "$COMMAND" ]; then - echo "Usage: build.sh command" - exit 1 -fi - -command__${COMMAND} diff --git a/tests/storage/dav/servers/skip/__init__.py b/tests/storage/dav/servers/skip/__init__.py new file mode 100644 index 0000000..c3d2c39 --- /dev/null +++ b/tests/storage/dav/servers/skip/__init__.py @@ -0,0 +1,7 @@ +import pytest + +class ServerMixin(object): + + @pytest.fixture + def get_storage_args(self): + pytest.skip('DAV tests disabled.') diff --git a/tests/storage/dav/servers/skip/install.sh b/tests/storage/dav/servers/skip/install.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/tests/storage/dav/servers/skip/install.sh @@ -0,0 +1 @@ +#!/bin/sh