Skip to content

bpo-30934: IDLE: Add Linux/MacOS coverage usage #2733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Lib/idlelib/idle_test/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ python -m idlelib.idle_test.htest
5. Test Coverage

Install the coverage package into your Python 3.6 site-packages
directory. (Its exact location depends on the OS).
directory. (Its exact location depends on the OS).
> python3 -m pip install coverage
(On Windows, replace 'python3 with 'py -3.6' or perhaps just 'python'.)

Expand Down Expand Up @@ -215,3 +215,28 @@ rem Above opens new report; htmlcov\index.html displays report index
---
The second parameter was added for tests of module x not named test_x.
(There were several before modules were renamed, now only one is left.)


Coverage on Linux and MacOS
---------------------------

First, install coverage in virtualenv:

$ cd cpython # Goto cpython root directory
$ ./python -m venv venv # Create venv
$ source venv/bin/activate
$ (venv) python -m pip install coverage # Notice that is using `python`, not `./python`

then, using command line to manipulate like this:

$ (venv) python -m coverage run --source Lib/idlelib Lib/idlelib/idle_test/test_config.py
$ (venv) python -m coverage report --show-missing
$ (venv) python -m coverage html

You can replace `test_config.py` to the test you want to mesure, and the source
argument, you can set to specific file like `Lib/idlelib/config.py`.

If you don't want to do it in virtualenv, you can move coverage from venv to Lib:

$ cp -r venv/lib/python3.7/site-packages/coverage Lib/coverage
$ ./python -m coverage run --source Lib/idlellib Lib/idlelib/idle_test/test_config.py