diff --git a/templates/python/testing/pytest/README.md b/templates/python/testing/pytest/README.md index e006bb4d72ef4a0672318cf9d1350123e99181de..9019087500d49d95a46c456209dff0c9b96203de 100644 --- a/templates/python/testing/pytest/README.md +++ b/templates/python/testing/pytest/README.md @@ -16,8 +16,9 @@ automation, modular fixtures, parameterized testing, and many other features. | Name | Description | Default | |----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------| -| `PYTHON_SETUP` | Bash commands to setup your python environment. Default rely on `pyproject.toml` to install project and test dependencies. | `"pip install .[TESTS]"` | +| `PROJECT_PATH` | The path to the project root directory. | `"."` | | `IMAGE_TAG` | The default tag for the docker image. See [Python Docker Official Image](https://hub.docker.com/_/python) for supported tags and respective Dockerfile links | `"latest"` | +| `PYTHON_SETUP` | Bash commands to setup your python environment. Default rely on `pyproject.toml` to install project and test dependencies. | `"pip install .[TESTS]"` | ## Global Configuration of pytest diff --git a/templates/python/testing/pytest/pytest.yml b/templates/python/testing/pytest/pytest.yml index ad687e2acb35910ceac4ff862d3be340c2e4a7ab..e1061965b5ec8ccbe40f34073d609ea23a90500b 100644 --- a/templates/python/testing/pytest/pytest.yml +++ b/templates/python/testing/pytest/pytest.yml @@ -2,16 +2,17 @@ pytest: image: python:${IMAGE_TAG} stage: test variables: - PYTHON_SETUP: "pip install .[TESTS]" IMAGE_TAG: "latest" + 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} - - pytest + - pytest ${PROJECT_PATH} only: changes: - - ./**/*.py + - ${PROJECT_PATH}/**/*.py - .gitlab-ci.yml - - pyproject.toml + - ${PROJECT_PATH}/pyproject.toml