gh-75117: IDLE - add script for running coverage on tests by taleinat · Pull Request #22694 · python/cpython (original) (raw)

This adds a cross-platform script for generating coverage info for any single IDLE module or for all of IDLE.

The script uses a dedicated venv in Lib/idlelib/test_idle/coverage_venv/, creating it if not found. The coverage package is installed into this venv.

The script also writes a temporary .coveragerc file to ignore irrelevant code. If an existing .coveragerc exists, it is temporarily overwritten.

This is heavily based on @terryjreedy's instructions in Lib/idlelib/test_idle/README, adapted to be cross-platform and hopefully robust in terms of where it is run from and where it leaves files lying around.

This has currently only been tested on Ubuntu 20.04, and should be tested on macOS and Windows.