Skip to content

Facing issue No source for code while combining multiple coverage files #1753

@AGpta

Description

@AGpta

Describe the bug
A clear and concise description of the bug.
I have set up Azure CICD where i am running pytest-split to run unit test cases in parallel and every job generates .coverage.* file.
After completing all parallel jobs, i am downloading all coverage file in one place then running coverage combine and coverage xml command to get combined coverage report. In feb month it was running fine but in march, it stated giving bellow issue

To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:

  1. What version of Python are you using? 3.7
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
-- sys -------------------------------------------------------
               coverage_version: 7.4.3
                coverage_module: c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages\coverage\__init__.py
                           core: -none-
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: .coveragerc
                                 setup.cfg
                                 tox.ini
                                 pyproject.toml
                   configs_read: -none-
                    config_file: None
                config_contents: -none-
                      data_file: -none-
  1. What versions of what packages do you have installed? The output of pip freeze is helpful.
  2. What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.
  3. What commands should we run to reproduce the problem? Be specific. Include everything, even git clone, pip install, and so on. Explain like we're five!
    Below are task used in azure cicd. You can refer commands in below tasks.
      - task: CmdLine@2
        inputs:
          script: |
            pytest  --splits $(System.TotalJobsInPhase) --group $(System.JobPositionInPhase) --splitting-algorithm least_duration --store-durations --clean-durations -vv ./DataEngineering/Test/GTLS/ --cov=$(WORKING_DIR)/DataEngineering/GTLS/ --junitxml=test-unit.xml  --cov-report=xml --report-log=test-cases.$(System.JobPositionInPhase).json
          workingDirectory: '$(System.DefaultWorkingDirectory)'
        env:
          COVERAGE_FILE: .coverage.$(System.JobPositionInPhase)
        displayName: "Run Unit tests and generate coverage report"
      - script: | 
          pip install coverage
          coverage debug sys
          mv **/.coverage* .
          coverage combine --debug=pathmap
          coverage xml -o combined-coverage.xml
        workingDirectory: $(System.DefaultWorkingDirectory)
        displayName: Combining Coverage Reports

Expected behavior
A clear and concise description of what you expected to happen.
All coverage files should be combined into one which was previously happening but now it is giving error No source for code.
ss of previous Successful run:
image

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions