def send_coverage_to_codecov(flag): """Send the coverage report to Codecov with the given flag.""" if CONFIG.get('COVERAGE', False): logger.info("Sending coverage results to codecov for flag %s." % flag) subprocess.call( "bash -c 'bash <(curl -s https://codecov.io/bash) -c -F %s'" % flag, shell=True)
def send_coverage_to_codecov(flag): """Send the coverage report to Codecov with the given flag.""" if CONFIG.get('COVERAGE', False): logger.info("Sending coverage results to codecov for flag %s." % flag) subprocess.check_call( "bash -c 'bash <(curl -s https://codecov.io/bash) -c -F %s'" % flag, shell=True)
def profiling_cmdline(cmdline, output_basename): """Return a cmdline possibly decorated to record profiling information.""" profiler = CONFIG.get("PROFILER", PROFILER_NONE) if profiler == PROFILER_NONE: return cmdline elif profiler == PROFILER_YAPPI: return _format_cmdline(_YAPPI_CMDLINE, cmdline, output_basename) elif profiler == PROFILER_KERNPROF: return _format_cmdline(_KERNPROF_CMDLINE, cmdline, output_basename) else: raise ValueError("Unknown profiler %s" % profiler)
def _spawn(cmdline): """Execute a python application.""" def kill(job): try: job.kill() except OSError: pass if CONFIG["VERBOSITY"] >= 1: logger.info("$ %s", " ".join(cmdline)) if CONFIG["TEST_DIR"] is not None and CONFIG.get("COVERAGE"): cmdline = Program._COVERAGE_CMDLINE + cmdline if CONFIG["VERBOSITY"] >= 3: stdout = None stderr = None else: stdout = io.open(os.devnull, "wb") stderr = stdout job = subprocess.Popen(cmdline, stdout=stdout, stderr=stderr) atexit.register(lambda: kill(job)) return job
def _spawn(cmdline): """Execute a python application.""" def kill(job): try: job.kill() except OSError: pass if CONFIG["VERBOSITY"] >= 1: logger.info("$" + " ".join(cmdline)) if CONFIG["TEST_DIR"] is not None and CONFIG.get("COVERAGE"): cmdline = Program._COVERAGE_CMDLINE + cmdline if CONFIG["VERBOSITY"] >= 3: stdout = None stderr = None else: stdout = io.open(os.devnull, "wb") stderr = stdout job = subprocess.Popen(cmdline, stdout=stdout, stderr=stderr) atexit.register(lambda: kill(job)) return job
import atexit import tempfile import subprocess import shutil import os from argparse import ArgumentParser from cms import utf8_decoder from cmstestsuite import info, sh, configure_cms, read_cms_config, CONFIG # These settings are only used within this file. CONFIG.update({ "DB_HOST": "localhost", "DB_USER": "******", "DB_PASSWORD": "******", "DB_NAME": "cmstestdb", "GIT_ORIGIN": None, "GIT_REVISION": None, }) def drop_old_data(): info("Dropping any old databases called %(DB_NAME)s." % CONFIG) sh("sudo -u postgres dropdb %(DB_NAME)s" % CONFIG, ignore_failure=True) info("Purging old checkout from %(TEST_DIR)s." % CONFIG) shutil.rmtree("%(TEST_DIR)s" % CONFIG) def setup_cms(): info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." %
def combine_coverage(): """Combine coverage reports from different programs.""" if CONFIG.get('COVERAGE', False): logger.info("Combining coverage results.") sh([sys.executable, "-m", "coverage", "combine"])
def clear_coverage(): """Clear existing coverage reports.""" if CONFIG.get('COVERAGE', False): logging.info("Clearing old coverage data.") sh([sys.executable, "-m", "coverage", "erase"])
def coverage_cmdline(cmdline): """Return a cmdline possibly decorated to record coverage.""" if CONFIG.get('COVERAGE', False): return _COVERAGE_CMDLINE + cmdline else: return cmdline
def send_coverage_to_codecov(flag): """Send the coverage report to Codecov with the given flag.""" if CONFIG.get('COVERAGE', False): logger.info("Sending coverage results to codecov for flag %s." % flag) uploader = _get_codecov_uploader() subprocess.check_call([uploader, "-F", flag])