Skip to content

test: coverage not being collected warning #1254

@cbueth

Description

@cbueth

Current Behavior

When currently running specific tests with tox as tox -e py313 -- tests/unit/gaze/gaze_init_test.py,

=========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
cachedir: .tox/py313/.pytest_cache
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: ~/code/pymovements
configfile: pyproject.toml
plugins: cov-6.2.1, benchmark-5.1.0
collected 126 items                                                                                                                                                       

~/code/pymovements/.tox/py313/lib/python3.13/site-packages/coverage/control.py:943: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")                                                                                                           
tests/unit/gaze/gaze_init_test.py ...................................................................................................~/code/pymovements/.tox/py313/lib/python3.13/site-packages/pytest_cov/plugin.py:358: CovReportWarning: Failed to generate report: No data to report.                                                 
                                                                                                                                                                           
  warnings.warn(CovReportWarning(message), stacklevel=1)                                                                                                                   
...........................                                                                                                                                                
WARNING: Failed to generate report: No data to report.                                                                                                                     
                                                                                                                                                                           
                                                                                                                                                                    [100%] 

============================================================================= tests coverage ==============================================================================
____________________________________________________________ coverage: platform darwin, python 3.13.5-final-0 _____________________________________________________________

=========================================================================== 126 passed in 1.46s ===========================================================================
  py313: OK (4.08=setup[2.22]+cmd[1.85] seconds)
  congratulations :) (4.12 seconds)

There is a CoverageWarning, a CovReportWarning and a supposedly empty .coverage.py313 generated. The warnings might be slightly different if a coverage.xml is present.
Moving {posargs:.} up results in the same behaviour.

    pytest \
        {posargs:.} \
        --ignore=tests/benchmark \
        --ignore=tests/integration \
        --tb=long \
        --cov --cov-append \
        --cov-report term-missing \
        --cov-report html:htmlcov \
        --cov-report xml

Expected Behavior

Coverage should be collected and separate tests should be run.

Minimum acceptance criteria

We can consider refering the contributer to run pytest directly. Another option is to rename the current tox test entry to be specifically for CI, while having a reduced one to be use by the user. Preferably just the warning is fixed.

Failure Information (for bugs)

Please help provide information about the failure if this is a bug.
If it is not a bug, please remove the rest of this template.

Steps to Reproduce

  • Run tox -e py313 -- tests/unit/gaze/gaze_init_test.py

Context

Please provide any relevant information about your setup.
This is important in case the issue is not reproducible except for under certain conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions