Skip to content

Commit 50a0e37

Browse files
committed
docs: clarify how --source affects reporting commands. #1159
1 parent 6352398 commit 50a0e37

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

doc/cmd.rst

+7
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ but before the program invocation::
103103
$ coverage run --source=dir1,dir2 my_program.py arg1 arg2
104104
$ coverage run --source=dir1,dir2 -m packagename.modulename arg1 arg2
105105

106+
.. note::
107+
Specifying ``--source`` on the ``coverage run`` command line won't affect
108+
subsequent reporting commands like ``coverage xml``. Use the
109+
:ref:`source <config_run_source>` setting in the configuration file to apply
110+
the setting uniformly to all commands.
111+
112+
106113
Coverage.py can measure multi-threaded programs by default. If you are using
107114
more exotic concurrency, with the `multiprocessing`_, `greenlet`_, `eventlet`_,
108115
or `gevent`_ libraries, then coverage.py will get very confused. Use the

doc/config.rst

+4
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ file paths in the data file. This makes it easier to measure code in one (or
203203
multiple) environments, and then report in another. See :ref:`cmd_combine`
204204
for details.
205205

206+
Note that setting ``source`` has to be done in the configuration file rather
207+
than the command line for this option to work, since the reporting commands
208+
need to know the source origin.
209+
206210
.. versionadded:: 5.0
207211

208212
.. _config_run_source:

0 commit comments

Comments
 (0)