diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09a09125330e0692f94220938e91e060f06b9c32..ed1bc028ccaf1f99e1592d0d5c4ed8a79141eab7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,12 +10,12 @@ pytest: stage: templates variables: PROJECT_PATH: "tests/pytest_project" - PYTHON_SETUP: "pip install ${PROJECT_PATH} pytest" only: changes: - .gitlab-ci.yml - pyproject.toml - templates/python/testing/pytest/**/* + - tests/pytest_project/**/* flake8: stage: templates diff --git a/templates/python/code_quality/flake8/flake8.yml b/templates/python/code_quality/flake8/flake8.yml index 46343d07e6ed5b9e7a987383cf60d7645b1c28d0..f60bda1f178e542a55961c7888a928ade2dad6ce 100644 --- a/templates/python/code_quality/flake8/flake8.yml +++ b/templates/python/code_quality/flake8/flake8.yml @@ -1,6 +1,3 @@ -stages: - - code_quality - include: - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/python_install@latest.yaml' @@ -19,5 +16,4 @@ flake8: - ${PROJECT_PATH}/**/*.py - .gitlab-ci.yml - ${PROJECT_PATH}/pyproject.toml - - ${PROJECT_PATH}/setup.cfg - ${PROJECT_PATH}/.flake8 diff --git a/templates/python/testing/pytest/pytest.yml b/templates/python/testing/pytest/pytest.yml index e1061965b5ec8ccbe40f34073d609ea23a90500b..a9bb8b5c70ed620c840cca53d04a9f2a05ec250b 100644 --- a/templates/python/testing/pytest/pytest.yml +++ b/templates/python/testing/pytest/pytest.yml @@ -1,18 +1,19 @@ +include: + - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/python_install@latest.yaml' + pytest: image: python:${IMAGE_TAG} stage: test variables: - IMAGE_TAG: "latest" + IMAGE_TAG: !reference [.python_install, variables, IMAGE_TAG] PROJECT_PATH: "." PYTHON_SETUP: "pip install ${PROJECT_PATH}[TESTS]" script: - - python --version # Debug - - python -m venv venv --upgrade-deps || python -m venv venv # upgrade-deps is not supported before 3.9 - - source venv/bin/activate - - ${PYTHON_SETUP} + - !reference [.python_install, script] - pytest ${PROJECT_PATH} only: changes: - ${PROJECT_PATH}/**/*.py - .gitlab-ci.yml - ${PROJECT_PATH}/pyproject.toml + - ${PROJECT_PATH}/pytest.ini diff --git a/tests/pytest_project/pyproject.toml b/tests/pytest_project/pyproject.toml index b72bdace191a06760e4d8606b685f7204c7c515f..c27397ba3014facea26bcc601435f46bb58ca594 100644 --- a/tests/pytest_project/pyproject.toml +++ b/tests/pytest_project/pyproject.toml @@ -17,3 +17,8 @@ testpaths = [ "tests", "integration", ] + +[project.optional-dependencies] +TESTS = [ + "pytest", +]