---
python:pytest:
  image: registry.gitlab.com/notno/python-tests
  stage: test
  variables:
    PYTEST_COVERAGE_THRESHOLD: "25"
    CHECK_PATH: "./${PYTHON_PACKAGE}"
    EXTRA_ARGS: ""  # Set optional arguments
  before_script:
    - pip install .
  script:
    - pip install pytest pytest-asyncio pytest-xdist pytest-cov
    - python -m pytest -vvv --cov=${CHECK_PATH} --cov-fail-under=${PYTEST_COVERAGE_THRESHOLD} --junitxml=${CI_PROJECT_DIR}/pytest-report.xml --cov-report xml:pytest-coverage.xml ${EXTRA_ARGS}
  artifacts:
    reports:
      junit: pytest-report.xml
      cobertura: pytest-coverage.xml
  cache:
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
    paths:
      - .pytest_cache/
