Skip to content

Commit

Permalink
docs: mention sys.monitoring support
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Dec 27, 2023
1 parent 9a84eeb commit 3879b97
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

Nothing yet.
- In Python 3.12 and above, you can try an experimental core based on the new
:mod:`sys.monitoring <python:sys.monitoring>` module by defining a
``COVERAGE_CORE=sysmon`` environment variable. This should be faster, though
plugins and dynamic contexts are not yet supported with it. I am very
interested to hear how it works (or doesn't!) for you.


.. scriv-start-here
Expand Down
5 changes: 1 addition & 4 deletions coverage/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,7 @@ class Opts:
)
timid = optparse.make_option(
"", "--timid", action="store_true",
help=(
"Use a simpler but slower trace method. Try this if you get " +
"seemingly impossible results!"
),
help="Use the slower Python trace function core.",
)
title = optparse.make_option(
"", "--title", action="store", metavar="TITLE",
Expand Down
10 changes: 7 additions & 3 deletions doc/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,14 @@ There are many options:
--source=SRC1,SRC2,...
A list of directories or importable names of code to
measure.
--timid Use a simpler but slower trace method. Try this if you
get seemingly impossible results!
--timid Use the slower Python trace function core.
--debug=OPTS Debug options, separated by commas. [env:
COVERAGE_DEBUG]
-h, --help Get help on this command.
--rcfile=RCFILE Specify configuration file. By default '.coveragerc',
'setup.cfg', 'tox.ini', and 'pyproject.toml' are
tried. [env: COVERAGE_RCFILE]
.. [[[end]]] (checksum: 05d15818e42e6f989c42894fb2b3c753)
.. [[[end]]] (checksum: b1a0fffe2768fc142f1d97ae556b621d)
If you want :ref:`branch coverage <branch>` measurement, use the ``--branch``
flag. Otherwise only statement coverage is measured.
Expand Down Expand Up @@ -203,6 +202,11 @@ If your coverage results seem to be overlooking code that you know has been
executed, try running coverage.py again with the ``--timid`` flag. This uses a
simpler but slower trace method, and might be needed in rare cases.

In Python 3.12 and above, you can try an experimental core based on the new
:mod:`sys.monitoring <python:sys.monitoring>` module by defining a
``COVERAGE_CORE=sysmon`` environment variable. This should be faster, though
plugins and dynamic contexts are not yet supported with it.

Coverage.py sets an environment variable, ``COVERAGE_RUN`` to indicate that
your code is running under coverage measurement. The value is not relevant,
and may change in the future.
Expand Down
6 changes: 3 additions & 3 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,9 @@ ambiguities between packages and directories.
[run] timid
...........

(boolean, default False) Use a simpler but slower trace method. This uses
PyTracer instead of CTracer, and is only needed in very unusual circumstances.
Try this if you get seemingly impossible results.
(boolean, default False) Use a simpler but slower trace method. This uses the
PyTracer trace function core instead of CTracer, and is only needed in very
unusual circumstances.


.. _config_paths:
Expand Down
3 changes: 1 addition & 2 deletions doc/python-coverage.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ COMMAND REFERENCE
A list of packages or directories of code to be measured.

\--timid
Use a simpler but slower trace method. Try this if you get
seemingly impossible results!
Use the slower Python trace function core.

**xml** [ `options` ... ] [ `MODULES` ... ]

Expand Down

0 comments on commit 3879b97

Please sign in to comment.