exasol / python-toolbox

Infrastructure & Automation Tooling for Python Projects
https://exasol.github.io/python-toolbox/
MIT License
2 stars 0 forks source link

🐞 Coverage report fails on empty project #157

Closed ckunki closed 4 months ago

ckunki commented 5 months ago

I used the PTB workflow files for a new project repo saas-python-api which contains no code, yet, and only some placeholders for tests. Hence running tests does not generate any coverage.

The PTB workflow then fails due to no coverage available:

test/integration/test_placeholder.py::test_placeholder PASSED            [100%]

============================== 1 passed in 0.01s ===============================
/home/runner/.cache/pypoetry/virtualenvs/saas-api-dRykLEL3-py3.10/lib/python3.10/site-packages/coverage/control.py:887: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")

nox > poetry run coverage report -m
No data to report.
nox > Command poetry run coverage report -m failed with exit code 1
nox > Session coverage failed.

Expected Behaviour

PTB workflows terminate gracefully even on new virgin projects without any test or coverage.

tkilias commented 5 months ago

@ckunki can you for the moment, create a dummy test

ckunki commented 5 months ago

I could fix the CI build by adding an if statement to File .github/workflows/checks.yml:

      - name: Calculate Test Coverage
        if: ${{ hashFiles('.coverage') != '' }}
        run: poetry run nox -s coverage -- -- --db-version ${{ matrix.exasol-version }}
Nicoretti commented 4 months ago

This issue does not appear to be a bug within the toolbox itself, but rather a project setup issue. Accordingly, it will be addressed as part of Issue #166 on our GitHub repository.