コード例 #1
0
def test_PackageManagerInstaller_depends():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all, supports_depends=True)
    assert ['foo', 'bar'] == installer.get_depends(dict(depends=['foo', 'bar'], packages=['baz']))
    installer = PackageManagerInstaller(detect_fn_all, supports_depends=False)
    assert [] == installer.get_depends(dict(depends=['foo', 'bar'], packages=['baz']))
コード例 #2
0
def test_PackageManagerInstaller_unique():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)

    assert [] == installer.unique()
    assert [] == installer.unique([])
    assert [] == installer.unique([], [])
    assert ['a'] == installer.unique([], [], ['a'])
    assert ['a'] == installer.unique(['a'], [], ['a'])
    assert set(['a', 'b', 'c']) == set(installer.unique(['a', 'b', 'c'], ['a', 'b', 'c']))
    assert set(['a', 'b', 'c']) == set(installer.unique(['a'], ['b'], ['c']))
    assert set(['a', 'b', 'c']) == set(installer.unique(['a', 'b'], ['c']))    
    assert set(['a', 'b', 'c']) == set(installer.unique(['a', 'b'], ['c', 'a']))    
コード例 #3
0
def test_PackageManagerInstaller():
    from rosdep2.installers import PackageManagerInstaller
    try:
        PackageManagerInstaller(detect_fn_all).get_install_command(['foo'])
        assert False
    except NotImplementedError:
        pass
コード例 #4
0
def test_PackageManagerInstaller_is_installed():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    for r in ['a', 'b', 'c']:
        assert True == installer.is_installed(r), installer.is_installed(r)
    installer = PackageManagerInstaller(detect_fn_empty)
    for r in ['a', 'b', 'c']:
        assert False == installer.is_installed(r), installer.is_installed(r)
コード例 #5
0
def test_PackageManagerInstaller_get_packages_to_install():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    assert [] == installer.get_packages_to_install([])
    assert [] == installer.get_packages_to_install(['a', 'b', 'c'])
    assert set(['a', 'b', 'c']) == set(installer.get_packages_to_install(['a', 'b', 'c'], reinstall=True))
    
    installer = PackageManagerInstaller(detect_fn_empty)
    assert set(['a', 'b', 'c']) == set(installer.get_packages_to_install(['a', 'b', 'c']))
    assert set(['a', 'b', 'c']) == set(installer.get_packages_to_install(['a', 'b', 'c'], reinstall=True))
    installer = PackageManagerInstaller(detect_fn_single)
    assert set(['baba', 'cada']) == set(installer.get_packages_to_install(['a', 'baba', 'b', 'cada', 'c']))
コード例 #6
0
def test_PackageManagerInstaller_depends():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all, supports_depends=True)
    assert ['foo', 'bar'] == installer.get_depends(
        dict(depends=['foo', 'bar'], packages=['baz']))
    installer = PackageManagerInstaller(detect_fn_all, supports_depends=False)
    assert [] == installer.get_depends(
        dict(depends=['foo', 'bar'], packages=['baz']))
コード例 #7
0
def test_PackageManagerInstaller_is_installed():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    for r in ['a', 'b', 'c']:
        assert True == installer.is_installed(r), installer.is_installed(r)
    installer = PackageManagerInstaller(detect_fn_empty)
    for r in ['a', 'b', 'c']:
        assert False == installer.is_installed(r), installer.is_installed(r)
コード例 #8
0
def test_PackageManagerInstaller_get_packages_to_install():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    assert [] == installer.get_packages_to_install([])
    assert [] == installer.get_packages_to_install(['a', 'b', 'c'])
    assert set(['a', 'b', 'c']) == set(
        installer.get_packages_to_install(['a', 'b', 'c'], reinstall=True))

    installer = PackageManagerInstaller(detect_fn_empty)
    assert set(['a', 'b',
                'c']) == set(installer.get_packages_to_install(['a', 'b',
                                                                'c']))
    assert set(['a', 'b', 'c']) == set(
        installer.get_packages_to_install(['a', 'b', 'c'], reinstall=True))
    installer = PackageManagerInstaller(detect_fn_single)
    assert set(['baba', 'cada']) == set(
        installer.get_packages_to_install(['a', 'baba', 'b', 'cada', 'c']))
コード例 #9
0
def test_PackageManagerInstaller_unique():
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)

    assert [] == installer.unique()
    assert [] == installer.unique([])
    assert [] == installer.unique([], [])
    assert ['a'] == installer.unique([], [], ['a'])
    assert ['a'] == installer.unique(['a'], [], ['a'])
    assert set(['a', 'b',
                'c']) == set(installer.unique(['a', 'b', 'c'],
                                              ['a', 'b', 'c']))
    assert set(['a', 'b', 'c']) == set(installer.unique(['a'], ['b'], ['c']))
    assert set(['a', 'b', 'c']) == set(installer.unique(['a', 'b'], ['c']))
    assert set(['a', 'b', 'c']) == set(installer.unique(['a', 'b'],
                                                        ['c', 'a']))
コード例 #10
0
def test_PackageManagerInstaller_resolve():
    from rosdep2 import InvalidData
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    assert ['baz'] == installer.resolve(
        dict(depends=['foo', 'bar'], packages=['baz']))
    assert ['baz', 'bar'] == installer.resolve(dict(packages=['baz', 'bar']))

    #test string logic
    assert ['baz'
            ] == installer.resolve(dict(depends=['foo', 'bar'],
                                        packages='baz'))
    assert ['baz', 'bar'] == installer.resolve(dict(packages='baz bar'))
    assert ['baz'] == installer.resolve('baz')
    assert ['baz', 'bar'] == installer.resolve('baz bar')

    #test list logic
    assert ['baz'] == installer.resolve(['baz'])
    assert ['baz', 'bar'] == installer.resolve(['baz', 'bar'])

    # test invalid data
    try:
        installer.resolve(0)
        assert False, "should have raised"
    except InvalidData:
        pass
コード例 #11
0
def test_PackageManagerInstaller_resolve():
    from rosdep2 import InvalidData
    from rosdep2.installers import PackageManagerInstaller

    installer = PackageManagerInstaller(detect_fn_all)
    assert ['baz'] == installer.resolve(dict(depends=['foo', 'bar'], packages=['baz']))
    assert ['baz', 'bar'] == installer.resolve(dict(packages=['baz', 'bar']))

    #test string logic
    assert ['baz'] == installer.resolve(dict(depends=['foo', 'bar'], packages='baz'))
    assert ['baz', 'bar'] == installer.resolve(dict(packages='baz bar'))
    assert ['baz'] == installer.resolve('baz')
    assert ['baz', 'bar'] == installer.resolve('baz bar')

    #test list logic
    assert ['baz'] == installer.resolve(['baz'])
    assert ['baz', 'bar'] == installer.resolve(['baz', 'bar'])

    # test invalid data
    try:
        installer.resolve(0)
        assert False, "should have raised"
    except InvalidData: pass