Skip to content

Commit

Permalink
docs: clarify how --source affects reporting commands. #1159
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Oct 18, 2021
1 parent 6352398 commit 50a0e37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ but before the program invocation::
$ coverage run --source=dir1,dir2 my_program.py arg1 arg2
$ coverage run --source=dir1,dir2 -m packagename.modulename arg1 arg2

.. note::
Specifying ``--source`` on the ``coverage run`` command line won't affect
subsequent reporting commands like ``coverage xml``. Use the
:ref:`source <config_run_source>` setting in the configuration file to apply
the setting uniformly to all commands.


Coverage.py can measure multi-threaded programs by default. If you are using
more exotic concurrency, with the `multiprocessing`_, `greenlet`_, `eventlet`_,
or `gevent`_ libraries, then coverage.py will get very confused. Use the
Expand Down
4 changes: 4 additions & 0 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ file paths in the data file. This makes it easier to measure code in one (or
multiple) environments, and then report in another. See :ref:`cmd_combine`
for details.

Note that setting ``source`` has to be done in the configuration file rather
than the command line for this option to work, since the reporting commands
need to know the source origin.

.. versionadded:: 5.0

.. _config_run_source:
Expand Down

0 comments on commit 50a0e37

Please sign in to comment.