pytest-dev / pytest-cov

Coverage plugin for pytest.
MIT License
1.72k stars 211 forks source link

Pytest-watch with coverage (If not existent) #639

Open brunolnetto opened 4 months ago

brunolnetto commented 4 months ago

What's the problem this feature will solve?

I can:

  1. run tests with package pytest-cov by command run coverage run --rcfile=.coveragerc -m pytest.
  2. generate coverage with package pytest-cov by command run coverage report --show-missing.
  3. watch tests with package pytest-watch by command run ptw --quiet --spool 200 --clear --nobeep --config pytest.ini --ext=.py --onfail="echo Tests failed, fix the issues" -v

I would like to have a way to watch coverage while testing as well. May you enlight me?

Describe the solution you'd like

I wrote following bash script ith desired solution:

#!/bin/bash
clear

while true; do
  coverage run --rcfile=.coveragerc -m pytest
  coverage report --show-missing

  sleep 5  # Adjust delay between test runs if needed
  clear
done

Alternative Solutions

I have not found the proper way to proceed.