pytest:
    image: python:${IMAGE_TAG}
    stage: test
    variables:
        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 ${PROJECT_PATH}
    only:
        changes:
            - ${PROJECT_PATH}/**/*.py
            - .gitlab-ci.yml
            - ${PROJECT_PATH}/pyproject.toml