[tests/mod] auto clone/pull the test app when running tests

This commit is contained in:
Laurent Peuch 2020-05-03 22:17:15 +02:00
parent f760d6aa0f
commit e80fe075e6
2 changed files with 11 additions and 9 deletions

View file

@ -26,14 +26,6 @@ postinstall:
- pip install -U pip
- hash -d pip
- pip --cache-dir=.pip install pytest pytest-sugar pytest-mock requests-mock mock
- pushd src/yunohost/tests
- >
if [ ! -d "./apps" ]; then
git clone https://github.com/YunoHost/test_apps ./apps
fi
- cd apps
- git pull > /dev/null 2>&1
- popd
- export PYTEST_ADDOPTS="--color=yes"
cache:
paths:

View file

@ -1,3 +1,4 @@
import os
import pytest
import sys
import moulinette
@ -9,6 +10,15 @@ from contextlib import contextmanager
sys.path.append("..")
@pytest.fixture(scope="session", autouse=True)
def clone_test_app(request):
cwd = os.path.split(os.path.realpath(__file__))[0]
if not os.path.exists(cwd + "/apps"):
os.system("git clone https://github.com/YunoHost/test_apps %s/apps" % cwd)
else:
os.system("cd %s/apps && git pull > /dev/null 2>&1" % cwd)
@contextmanager
def message(mocker, key, **kwargs):