MishaKav / pytest-coverage-comment

Comments a pull request with the pytest code coverage badge and full report
MIT License
181 stars 60 forks source link

failed to produce the pytest-coverage.txt file #75

Closed AnantshreeChandola closed 2 years ago

AnantshreeChandola commented 2 years ago

I am running the CI inside Docker.

Sharing logs for more details: **`-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html --------------------- generated xml file: /tmp/pytest.xml ----------------------

---------- coverage: platform linux, python 3.8.12-final-0 -----------

================== 7 passed, 27 warnings in 181.54s (0:03:01) ================== /usr/local/lib/python3.8/site-packages/coverage/inorout.py:519: CoverageWarning: Module src was never imported. (module-not-imported) self.warn(f"Module {pkg} was never imported.", slug="module-not-imported") /usr/local/lib/python3.8/site-packages/coverage/control.py:794: CoverageWarning: No data was collected. (no-data-collected) self._warn("No data was collected.", slug="no-data-collected") /usr/local/lib/python3.8/site-packages/pytest_cov/plugin.py:294: CovReportWarning: Failed to generate report: No data to report.

self.cov_controller.finish()`

`Run MishaKav/pytest-coverage-comment@main with: pytest-coverage-path: /tmp/pytest-coverage.txt junitxml-path: /tmp/pytest.xml github-token: *** title: Coverage Report badge-title: Coverage hide-badge: false hide-report: false hide-comment: false report-only-changed-files: false create-new-comment: false default-branch: main File read successfully "/tmp/pytest-coverage.txt" Error: Error: coverage file "/tmp/pytest-coverage.txt" has bad format or wrong data File read successfully "/tmp/pytest.xml" File read successfully "/tmp/pytest.xml" errors: 0

failures: 0

skipped: 0

tests: 7

time: 181.542

File read successfully "/tmp/pytest.xml"

/tmp/pytest-coverage.txt Create commit comment`**

MishaKav commented 2 years ago

from what I see, the problem is not the action itself, you fail to generate the right - coverage.txt from your logs: Failed to generate report: No data to report. Try to fix your coverage report.