How to use the coverage.process_startup function in coverage

To help you get started, we’ve selected a few coverage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saltstack / salt / tests / support / parser / cover.py View on Github external
multiprocessing_stop,
            args=(coverage_object,),
            exitpriority=1000
        )

    if COVERAGE_AVAILABLE:
        multiprocessing.util.register_after_fork(
            multiprocessing_start,
            multiprocessing_start
        )
except ImportError:
    pass

if COVERAGE_AVAILABLE:
    # Cover any processes if the environ variables are present
    coverage.process_startup()


class SaltCoverageTestingParser(SaltTestingParser):
    '''
    Code coverage aware testing option parser
    '''
    def __init__(self, *args, **kwargs):
        if kwargs.pop('html_output_from_env', None) is not None or \
                kwargs.pop('html_output_dir', None) is not None:
            warnings.warn(
                'The unit tests HTML support was removed from {0}. Please '
                'stop passing \'html_output_dir\' or \'html_output_from_env\' '
                'as arguments to {0}'.format(self.__class__.__name__),
                category=DeprecationWarning,
                stacklevel=2
            )
github bottlepy / bottle / test / __init__.py View on Github external
from __future__ import with_statement
from .tools import chdir
import unittest
import sys, os

try:
    import coverage
    coverage.process_startup()
except ImportError:
    pass


if 'fast' in sys.argv:
    sys.stderr.write("Warning: The 'fast' keyword skipps server tests.\n")
    os.environ["TEST_FAST"] = "true"

import bottle
bottle.debug(True)
github inspirehep / hepcrawl / hepcrawl / testlib / scrapyd_coverage_runner.py View on Github external
def start_coverage():
    COV.start()
    coverage.process_startup()
github panoptes / POCS / sitecustomize.py View on Github external
# Ensure coverage starts for all Python processes so that test coverage is calculated
# properly when using subprocesses (see https://coverage.readthedocs.io/en/latest/subprocess.html)
import coverage

print("Starting coverage from sitecustomize")
coverage.process_startup()
github bogdandm / json2python-models / json_to_models / cli.py View on Github external
def main():
    import os

    if os.getenv("TRAVIS", None) or os.getenv("FORCE_COVERAGE", None):
        # Enable coverage if it is Travis-CI or env variable FORCE_COVERAGE set to true
        import coverage

        coverage.process_startup()

    cli = Cli()
    cli.parse_args()
    print(cli.run())
github RobotLocomotion / director / src / python / director / __init__.py View on Github external
def _initCoverage():
    if  'COVERAGE_PROCESS_START' in os.environ:
        try:
            import coverage
            coverage.process_startup()
        except ImportError:
            pass
github ihucos / plash / misc / sitecustomize_for_codecoverage / sitecustomize.py View on Github external
def patched_execlp(*args):
    from coverage import process_startup
    process_startup.coverage.save()
    orig(*args)