Ejemplo n.º 1
0
def finish_request_cov(self, request, client_address):
    cov = None
    if pid != os.getpid():
        cov = embed.init()
    try:
        return finish_request(self, request, client_address)
    finally:
        if cov:
            embed.cleanup(cov)
Ejemplo n.º 2
0
def finish_request_cov(self, request, client_address):
    cov = None
    if pid != os.getpid():
        cov = embed.init()
    try:
        return finish_request(self, request, client_address)
    finally:
        if cov:
            embed.cleanup(cov)
Ejemplo n.º 3
0
def setup_spark_worker(*a, **kw):
    """ Function used to execute some code only once on each worker. Is there a better way to do that? """

    if "_cosr_pyspark_setup_done" not in __builtins__:

        if os.getenv("COV_CORE_SOURCE"):
            from pytest_cov.embed import init
            cov = init()
            __builtins__["_cosr_pyspark_coverage"] = cov
            print "Coverage started for PID", os.getpid()

        __builtins__["_cosr_pyspark_setup_done"] = True
Ejemplo n.º 4
0
def setup_spark_worker(*a, **kw):
    """ Function used to execute some code only once on each worker. Is there a better way to do that? """

    if "_cosr_pyspark_setup_done" not in __builtins__:

        if os.getenv("COV_CORE_SOURCE"):
            from pytest_cov.embed import init
            cov = init()
            __builtins__["_cosr_pyspark_coverage"] = cov
            print("Coverage started for PID", os.getpid())

        __builtins__["_cosr_pyspark_setup_done"] = True
Ejemplo n.º 5
0
import os
import sys

if 'COV_CORE_SOURCE' in os.environ:
    try:
        from pytest_cov.embed import init
        init()
    except Exception as exc:
        sys.stderr.write(
            "pytest-cov: Failed to setup subprocess coverage. "
            "Environ: {0!r} "
            "Exception: {1!r}\n".format(
                dict((k, v) for k, v in os.environ.items() if k.startswith('COV_CORE')),
                exc
            )
        )