コード例 #1
0
def test_bad_workspace(tmpdir):
    args = parse_args(
        [str(tmpdir), '-a', 'aarch64', '-o', 'ubuntu', '-d', 'foxy'])
    test_collector = DataCollector()
    platform = Platform(args.arch, args.os, args.rosdistro)
    with pytest.raises(ValueError):
        cross_compile_pipeline(args, test_collector, platform)
コード例 #2
0
def test_mocked_cc_pipeline(tmpdir):
    args = parse_args([str(tmpdir), '-a', 'aarch64', '-o', 'ubuntu'])
    with patch('ros_cross_compile.ros_cross_compile.DockerClient', Mock(
    )) as docker_mock, patch(
            'ros_cross_compile.ros_cross_compile.assert_install_rosdep_script_exists'
    ) as script_mock:
        cross_compile_pipeline(args)
        assert script_mock.called
        assert docker_mock.called
        assert docker_mock().build_image.call_count == 2
        assert docker_mock().run_container.call_count == 2
コード例 #3
0
def test_mocked_cc_pipeline(tmpdir):
    tmp = Path(str(tmpdir))
    test_collector = DataCollector()
    (tmp / 'src').mkdir()
    args = parse_args([str(tmpdir), '-a', 'aarch64', '-o', 'ubuntu'])
    with patch('ros_cross_compile.ros_cross_compile.DockerClient', Mock(
    )) as docker_mock, patch(
            'ros_cross_compile.dependencies.assert_install_rosdep_script_exists'
    ) as script_mock:
        cross_compile_pipeline(args, test_collector)
        assert script_mock.called
        assert docker_mock.called
        assert docker_mock().build_image.call_count == 2
        assert docker_mock().run_container.call_count == 2
コード例 #4
0
def test_relative_workspace(tmpdir):
    # Change directory to the tmp dir and invoke using '.' as the
    # workspace to check if relative paths work
    tmp = Path(str(tmpdir))
    (tmp / 'src').mkdir()
    relative_dir = '.'
    args = parse_args(
        [relative_dir, '-a', 'aarch64', '-o', 'ubuntu', '-d', 'foxy'])
    with chdir(str(tmp)), patch(
            'ros_cross_compile.ros_cross_compile.DockerClient', Mock()
    ), patch(
            'ros_cross_compile.ros_cross_compile.assert_install_rosdep_script_exists'
    ):
        # should not raise an exception
        cross_compile_pipeline(args)
コード例 #5
0
def test_trivial_argparse():
    args = parse_args(['somepath', '-a', 'aarch64', '-o', 'ubuntu'])
    assert args
コード例 #6
0
def test_trivial():
    args = parse_args(['-a', 'aarch64', '-o', 'ubuntu'])
    assert args
コード例 #7
0
def test_bad_workspace(tmpdir):
    args = parse_args(
        [str(tmpdir), '-a', 'aarch64', '-o', 'ubuntu', '-d', 'foxy'])
    with pytest.raises(ValueError):
        cross_compile_pipeline(args)