Coverage command for Python test "not found"?

When running the test stage of my Python 3.7 project, the tests are executed and pass as expected.

The CI configuration from .gitlab-ci.yml is as follows:

pytest:
  stage: Testing
  script:
    - pip install coverage
    - cd src
    - python -m pytest --cov=.
    - coverage xml
  artifacts:
    reports:
      cobertura: src/coverage.xml

The error I am seeing is:

$ coverage xml
/bin/bash: line 130: coverage: command not found
Uploading artifacts for failed job
Uploading artifacts...
WARNING: src/coverage.xml: no matching files       
ERROR: No files to upload                          
Cleaning up file based variables
ERROR: Job failed: exit code 1

Coverage (as a command) seems to work on my local machine within a normal Python virtualenv and the coverage.xml file is generated within the src directory.

@gamesbook - Thanks for the post!

Having the full log here to ensure the line pip install coverage ran successfully would help. My best guess is that command did not complete successfully.

Hope this helps!

-James H, GitLab Product Manager, Verify:Testing