Skip to content

Commit 43bf46b

Browse files
committed
docs: --save-signal #1998 Thanks, Arkady Gilinsky
1 parent 17fa2ad commit 43bf46b

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ Unreleased
3838
abruptly end the process. This closes long-standing `issue 310`_ as well as
3939
its duplicates: `issue 312`_, `issue 1845`_, and `issue 1941`_.
4040

41+
- A new command-line option: ``--save-signal=USR1`` specifies a signal that
42+
coverage.py will listen for. When the signal is sent, the coverage data will
43+
be saved. This makes it possible to save data from within long-running
44+
processes. Thanks, `Arkady Gilinsky <pull 1998_>`_.
45+
4146
- A new configuration option: ":ref:`config_report_partial_also`" is a list of
4247
regexes to add as pragmas for partial branches. This parallels the
4348
":ref:`config_report_exclude_also`" setting for adding line exclusion
@@ -56,6 +61,7 @@ Unreleased
5661
.. _issue 1308: https://github.com/nedbat/coveragepy/issues/1308
5762
.. _issue 1845: https://github.com/nedbat/coveragepy/issues/1845
5863
.. _issue 1941: https://github.com/nedbat/coveragepy/issues/1941
64+
.. _pull 1998: https://github.com/nedbat/coveragepy/pull/1998
5965
.. _issue 2001: https://github.com/nedbat/coveragepy/issues/2001
6066

6167

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Anders Kaseorg
2121
Andrew Hoos
2222
Anthony Sottile
2323
Arcadiy Ivanov
24+
Arkady Gilinsky
2425
Aron Griffis
2526
Artem Dayneko
2627
Arthur Deygin

coverage/cmdline.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,11 @@ class Opts:
191191
),
192192
)
193193
save_signal = optparse.make_option(
194-
'', '--save-signal', action='store', metavar='SAVE_SIGNAL',
194+
'', '--save-signal', action='store', metavar='SIGNAL',
195195
choices = ['USR1', 'USR2'],
196196
help=(
197-
"Define a system signal that will trigger coverage report save operation. " +
198-
"It is important that target script do not intercept this signal. " +
199-
"Currently supported options are: USR1, USR2. " +
200-
"This feature does not work on Windows."
197+
"Specify a signal that will trigger coverage to write its collected data. " +
198+
"Supported values are: USR1, USR2. Not available on Windows."
201199
),
202200
)
203201
show_contexts = optparse.make_option(

doc/cmd.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,9 @@ There are many options:
133133
-p, --parallel-mode Append the machine name, process id and random number
134134
to the data file name to simplify collecting data from
135135
many processes.
136-
--save-signal=SAVE_SIGNAL
137-
Define a system signal that will trigger coverage
138-
report save operation. It is important that target
139-
script do not intercept this signal. Currently
140-
supported options are: USR1, USR2. This feature does
141-
not work on Windows.
136+
--save-signal=SIGNAL Specify a signal that will trigger coverage to write
137+
its collected data. Supported values are: USR1, USR2.
138+
Not available on Windows.
142139
--source=SRC1,SRC2,...
143140
A list of directories or importable names of code to
144141
measure.
@@ -149,7 +146,7 @@ There are many options:
149146
--rcfile=RCFILE Specify configuration file. By default '.coveragerc',
150147
'setup.cfg', 'tox.ini', and 'pyproject.toml' are
151148
tried. [env: COVERAGE_RCFILE]
152-
.. [[[end]]] (sum: X8Kbvdq2+f)
149+
.. [[[end]]] (sum: 1Ks5r6cadh)
153150
154151
If you want :ref:`branch coverage <branch>` measurement, use the ``--branch``
155152
flag. Otherwise only statement coverage is measured.
@@ -221,9 +218,9 @@ and may change in the future.
221218
These options can also be set in the :ref:`config_run` section of your
222219
.coveragerc file.
223220

224-
In case if you are specifying ``--save-signal``, please make sure that
225-
your target script doesn't intercept this signal. Otherwise the coverage
226-
reports will not be generated.
221+
If you are specifying ``--save-signal``, please make sure that your program
222+
doesn't intercept this signal. If it does, coverage won't receive the signal
223+
and the data file will not be written.
227224

228225
.. _cmd_warnings:
229226

0 commit comments

Comments
 (0)