mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-30 09:45:53 +00:00
Use pytest-xprocess for process management
This commit is contained in:
parent
c492813487
commit
414b986450
6 changed files with 30 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -6,3 +6,5 @@ build
|
|||
env
|
||||
owncloud-testserver
|
||||
*.egg-info
|
||||
.cache
|
||||
.xprocess
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ radicale_deps() {
|
|||
}
|
||||
|
||||
davserver_owncloud() {
|
||||
git clone https://github.com/untitaker/owncloud-testserver.git
|
||||
# Maybe tmpfs is mounted on /tmp/, can't harm anyway.
|
||||
git clone --depth=1 https://github.com/untitaker/owncloud-testserver.git /tmp/owncloud-testserver
|
||||
ln -s /tmp/owncloud-testserver .
|
||||
cd ./owncloud-testserver/
|
||||
sh install.sh
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
pytest
|
||||
pytest-xprocess
|
||||
mock
|
||||
git+https://github.com/geier/leif
|
||||
|
|
|
|||
14
run-tests.sh
14
run-tests.sh
|
|
@ -1,16 +1,4 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
[ -n "$DAV_SERVER" ] || DAV_SERVER=radicale_filesystem
|
||||
|
||||
davserver_radicale_database() { true; }
|
||||
davserver_radicale_filesystem() { true; }
|
||||
|
||||
davserver_owncloud() {
|
||||
sh ./owncloud-testserver/php.sh
|
||||
}
|
||||
|
||||
|
||||
# while it would be nice if the server was cleanly shut down, it's not really a
|
||||
# problem either
|
||||
davserver_$DAV_SERVER &
|
||||
py.test $@
|
||||
exec py.test $@
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ServerMixin(object):
|
|||
wsgi_teardown = None
|
||||
|
||||
def setup_method(self, method):
|
||||
subprocess.call([os.path.join(owncloud_repo, 'install.sh')])
|
||||
subprocess.check_call([os.path.join(owncloud_repo, 'install.sh')])
|
||||
|
||||
def get_storage_args(self, collection='test'):
|
||||
url = 'http://127.0.0.1:8080'
|
||||
|
|
|
|||
22
tests/storage/dav/conftest.py
Normal file
22
tests/storage/dav/conftest.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
vdirsyncer.tests.storage.dav.conftest
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
:copyright: (c) 2014 Markus Unterwaditzer
|
||||
:license: MIT, see LICENSE for more details.
|
||||
'''
|
||||
|
||||
import os
|
||||
import pytest
|
||||
|
||||
dav_server = os.environ.get('DAV_SERVER', '').strip() or 'radicale_filesystem'
|
||||
php_sh = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../owncloud-testserver/php.sh'))
|
||||
|
||||
if dav_server == 'owncloud':
|
||||
@pytest.fixture(autouse=True)
|
||||
def start_owncloud_server(xprocess):
|
||||
def preparefunc(cwd):
|
||||
return 'Listening on', ['sh', php_sh]
|
||||
|
||||
xprocess.ensure('owncloud_server', preparefunc)
|
||||
Loading…
Reference in a new issue