diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt index a54e74ddda2170..c4b21f26adf0ec 100644 --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -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'.) @@ -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