def run_tests_in_emulator(package):
    """Spawn an emulator instance and run the system tests.

    :type package: str
    :param package: The package to run system tests against.
    """
    # Make sure this package has environment vars to replace.
    env_vars = PACKAGE_INFO[package]

    start_command = get_start_command(package)
    # Ignore stdin and stdout, don't pollute the user's output with them.
    proc_start = subprocess.Popen(start_command,
                                  stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
    try:
        wait_ready(package, proc_start)
        env_init_command = get_env_init_command(package)
        proc_env = subprocess.Popen(env_init_command,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
        env_status = proc_env.wait()
        if env_status != 0:
            raise RuntimeError(env_status, proc_env.stderr.read())
        env_lines = proc_env.stdout.read().strip().split('\n')
        # Set environment variables before running the system tests.
        for env_var in env_vars:
            line_prefix = 'export ' + env_var + '='
            value, = [
                line.split(line_prefix, 1)[1] for line in env_lines
                if line.startswith(line_prefix)
            ]
            os.environ[env_var] = value
        run_module_tests(package, ignore_requirements=True)
    finally:
        cleanup(proc_start.pid)
Example #2
0
def run_tests_in_emulator(package):
    """Spawn an emulator instance and run the system tests.

    :type package: str
    :param package: The package to run system tests against.
    """
    # Make sure this package has environment vars to replace.
    env_vars = PACKAGE_INFO[package]

    start_command = get_start_command(package)
    # Ignore stdin and stdout, don't pollute the user's output with them.
    proc_start = subprocess.Popen(start_command, stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
    try:
        wait_ready(package, proc_start)
        env_init_command = get_env_init_command(package)
        proc_env = subprocess.Popen(env_init_command, stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
        env_status = proc_env.wait()
        if env_status != 0:
            raise RuntimeError(env_status, proc_env.stderr.read())
        env_lines = proc_env.stdout.read().strip().split('\n')
        # Set environment variables before running the system tests.
        for env_var in env_vars:
            line_prefix = 'export ' + env_var + '='
            value, = [line.split(line_prefix, 1)[1] for line in env_lines
                      if line.startswith(line_prefix)]
            os.environ[env_var] = value
        run_module_tests(package,
                         ignore_requirements=True)
    finally:
        cleanup(proc_start.pid)
def main():
    """Run all the system tests if necessary."""
    prepare_to_run()
    failed_modules = 0
    for module in MODULES:
        try:
            run_module_tests(module)
        except FailedSystemTestModule:
            failed_modules += 1

    sys.exit(failed_modules)
Example #4
0
def main():
    """Run all the system tests if necessary."""
    prepare_to_run()
    failed_modules = 0
    for module in MODULES:
        try:
            run_module_tests(module)
        except FailedSystemTestModule:
            failed_modules += 1

    sys.exit(failed_modules)
def main():
    """Run all the system tests if necessary."""
    prepare_to_run()
    for module in MODULES:
        run_module_tests(module)
def main():
    """Run all the system tests if necessary."""
    prepare_to_run()
    for module in MODULES:
        run_module_tests(module)