コード例 #1
0
ファイル: coverage.py プロジェクト: Nyrio/cms
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)
コード例 #2
0
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)
コード例 #3
0
ファイル: profiling.py プロジェクト: zj-cs2103/cms
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)
コード例 #4
0
ファイル: profiling.py プロジェクト: Nyrio/cms
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)
コード例 #5
0
    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
コード例 #6
0
ファイル: programstarter.py プロジェクト: PJeBeK/cms
    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
コード例 #7
0
ファイル: TestCleanCheckout.py プロジェクト: renegat96/cms
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." %
コード例 #8
0
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"])
コード例 #9
0
def clear_coverage():
    """Clear existing coverage reports."""
    if CONFIG.get('COVERAGE', False):
        logging.info("Clearing old coverage data.")
        sh([sys.executable, "-m", "coverage", "erase"])
コード例 #10
0
def coverage_cmdline(cmdline):
    """Return a cmdline possibly decorated to record coverage."""
    if CONFIG.get('COVERAGE', False):
        return _COVERAGE_CMDLINE + cmdline
    else:
        return cmdline
コード例 #11
0
ファイル: TestCleanCheckout.py プロジェクト: KKMahogany/cms
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." %
コード例 #12
0
ファイル: coverage.py プロジェクト: Nyrio/cms
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"])
コード例 #13
0
ファイル: coverage.py プロジェクト: Nyrio/cms
def clear_coverage():
    """Clear existing coverage reports."""
    if CONFIG.get('COVERAGE', False):
        logging.info("Clearing old coverage data.")
        sh([sys.executable, "-m", "coverage", "erase"])
コード例 #14
0
ファイル: coverage.py プロジェクト: Nyrio/cms
def coverage_cmdline(cmdline):
    """Return a cmdline possibly decorated to record coverage."""
    if CONFIG.get('COVERAGE', False):
        return _COVERAGE_CMDLINE + cmdline
    else:
        return cmdline
コード例 #15
0
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])