diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7459ae982..ac3584630 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: @@ -129,4 +121,4 @@ lint: #format-check: # extends: .lint-stage # script: -# - black --check --diff \ No newline at end of file +# - black --check --diff diff --git a/src/yunohost/tests/conftest.py b/src/yunohost/tests/conftest.py index bd1702571..073c880f8 100644 --- a/src/yunohost/tests/conftest.py +++ b/src/yunohost/tests/conftest.py @@ -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):