Python test coverage inside dedicated python dockerimage

Hello,

I need some help to setup python test coverage thats generates the xml in a dedicated docker image. Any tips/directions much appreciated.

Current setup (wip/dose not work)

sonarqube-check:
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - sonar-scanner -Dsonar.python.version=3
    - pip install --no-cache-dir -r requirements.txt
    - coverage run --source='.' manage.py test
    - coverage xml

  allow_failure: true
  only:
    - merge_requests

Hey there

I suppose the only question I can ask is – what happens when you execute it this way (what doesn’t work, exactly?) Is the coverage report produced but the scanner fails to find it? Do you get another error along the way?