explain the extra coverage stuff

This commit is contained in:
Jean-Paul Calderone 2021-01-04 12:06:03 -05:00
parent c9b3ccedb4
commit 9958236c31
1 changed files with 21 additions and 4 deletions

View File

@ -235,11 +235,28 @@ def run(configFactory=Options, argv=sys.argv, stdout=sys.stdout, stderr=sys.stde
def _setup_coverage(reactor, argv): def _setup_coverage(reactor, argv):
""" """
Arrange for coverage to be collected if the 'coverage' package is If coverage measurement was requested, start collecting coverage
installed measurements and arrange to record those measurements when the process is
done.
Coverage measurement is considered requested if ``"--coverage"`` is in
``argv`` (and it will be removed from ``argv`` if it is found). There
should be a ``.coveragerc`` file in the working directory if coverage
measurement is requested.
This is only necessary to support multi-process coverage measurement,
typically when the test suite is running, and with the pytest-based
*integration* test suite (at ``integration/`` in the root of the source
tree) foremost in mind. The idea is that if you are running Tahoe-LAFS in
a configuration where multiple processes are involved - for example, a
test process and a client node process, if you only measure coverage from
the test process then you will fail to observe most Tahoe-LAFS code that
is being run.
This function arranges to have any Tahoe-LAFS process (such as that
client node process) collect and report coverage measurements as well.
""" """
# can we put this _setup_coverage call after we hit # can we put this _setup_coverage call after we hit argument-parsing?
# argument-parsing?
if '--coverage' not in argv: if '--coverage' not in argv:
return return
argv.remove('--coverage') argv.remove('--coverage')