示例#1
0
def run_unit_tests():
    print('Running unit tests...')
    try:
        run_python('-m', 'unittest', '--verbose', cwd=unit_tests_path)
    except RunCommandError as e:
        print('Unit tests failed:', str(e), file=sys.stderr)
        return True
    return False
示例#2
0
def run_unit_tests():
    print("Running unit tests...")
    try:
        run_python("-m", "unittest", "--verbose", cwd=unit_tests_path)
    except RunCommandError as e:
        print("Unit tests failed:", str(e), file=sys.stderr)
        return True
    return False
示例#3
0
def run_test(dir_path, *args):
    command = [str(dir_path / 'run_test.py')] + list(args)
    s = repr(' '.join(command))
    print('Running', s, '...')
    try:
        run_python(*command, cwd=dir_path)
    except RunCommandError as e:
        print(s, 'failed:', str(e), file=sys.stderr)
        return True
    return False
示例#4
0
def run_test(dir_path, *args):
    command = [str(dir_path / "run_test.py")] + list(args)
    s = repr(" ".join(command))
    print("Running", s, "...")
    try:
        run_python(*command, cwd=dir_path)
    except RunCommandError as e:
        print(s, "failed:", str(e), file=sys.stderr)
        return True
    return False
示例#5
0
def run_test(args):
    build_dirname = "build_cpp11" if args.cpp11 else "build_classic"
    build_dir = this_dir / build_dirname

    if not args.just_run:
        cfg_args = []
        if args.cpp11:
            cfg_args.append("-DCPP11_IDL=ON")
        build_cmake_project(this_dir, build_dir, cfg_args=cfg_args)

        # Generate and Install Python Package
        pack_dir = "basic_output"
        run_command(
            "itl2py",
            "-o",
            pack_dir,
            "basic_idl",
            "basic.itl",
            cwd=build_dir,
            exit_on_error=True,
        )
        run_python(
            "-m",
            "pip",
            "--verbose",
            "install",
            ".",
            cwd=(build_dir / pack_dir),
            exit_on_error=True,
        )

    # Run the test
    pub = run_command(
        build_dir / "publisher",
        "-DCPSConfigFile",
        "rtps.ini",
        return_popen=True,
        cwd=this_dir,
        add_library_paths=[build_dir],
    )
    sub = run_python(
        this_dir / "subscriber.py",
        cwd=this_dir,
        return_popen=True,
        add_library_paths=[build_dir],
    )
    wait_or_kill(pub, timeout)
    wait_or_kill(sub, timeout)