Exemplo n.º 1
0
def test_is_installed():
    from rosdep2.platforms.source import SourceInstaller, SourceInstall
    resolved = SourceInstall()
    resolved.check_presence_command = """#!/bin/bash
exit 0
"""
    installer = SourceInstaller()
    assert installer.is_installed(resolved)
Exemplo n.º 2
0
def test_is_installed():
    from rosdep2.platforms.source import SourceInstaller, SourceInstall
    resolved = SourceInstall()
    resolved.check_presence_command = """#!/bin/bash
exit 0
"""
    installer = SourceInstaller()
    assert installer.is_installed(resolved)
Exemplo n.º 3
0
def test_SourceInstaller_resolve():
    from rosdep2.platforms.source import SourceInstaller, InvalidData
    test_dir = get_test_dir()

    url = 'https://kforge.ros.org/rosrelease/rosdep/raw-file/908818f28156/test/source/rep112-example.rdmanifest'
    md5sum_good = 'af0dc0e2d0c0c3181dd7670c4147f155'
    md5sum_bad = 'fake'

    installer = SourceInstaller()
    try:
        installer.resolve({})
        assert False, "should have raised"
    except InvalidData:
        pass
    try:
        installer.resolve(dict(uri=url, md5sum=md5sum_bad))
        assert False, "should have raised"
    except InvalidData:
        pass
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))

    assert type(resolved) == list
    assert len(resolved) == 1
    resolved = resolved[0]

    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command

    # test again to activate caching
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command
Exemplo n.º 4
0
def test_SourceInstaller_resolve():
    from rosdep2.platforms.source import SourceInstaller, InvalidData
    test_dir = get_test_dir()

    url = 'https://kforge.ros.org/rosrelease/rosdep/raw-file/908818f28156/test/source/rep112-example.rdmanifest'
    md5sum_good = 'af0dc0e2d0c0c3181dd7670c4147f155'
    md5sum_bad = 'fake'

    installer = SourceInstaller()
    try:
        installer.resolve({})
        assert False, "should have raised"
    except InvalidData:
        pass
    try:
        installer.resolve(dict(uri=url, md5sum=md5sum_bad))
        assert False, "should have raised"
    except InvalidData:
        pass
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
        
    assert type(resolved) == list
    assert len(resolved) == 1
    resolved = resolved[0]

    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command

    # test again to activate caching
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command
Exemplo n.º 5
0
def test_SourceInstaller_get_install_command():
    from rosdep2.platforms.source import SourceInstaller, SourceInstall
    installer = SourceInstaller()

    resolved = SourceInstall()
    resolved.manifest_url = 'http://fake/foo'
    resolved.check_presence_command = """#!/bin/bash
exit 1
"""
    commands = installer.get_install_command([resolved])
    assert len(commands) == 1
    assert commands[0] == ['rosdep-source', 'install', 'http://fake/foo']

    resolved = SourceInstall()
    resolved.manifest_url = 'http://fake/foo'
    resolved.check_presence_command = """#!/bin/bash
exit 0
"""
    commands = installer.get_install_command([resolved])
    assert not(commands)
Exemplo n.º 6
0
def test_SourceInstaller_get_install_command():
    from rosdep2.platforms.source import SourceInstaller, SourceInstall
    installer = SourceInstaller()

    resolved = SourceInstall()
    resolved.manifest_url = 'http://fake/foo'
    resolved.check_presence_command = """#!/bin/bash
exit 1
"""
    commands = installer.get_install_command([resolved])
    assert len(commands) == 1
    assert commands[0] == ['rosdep-source', 'install', 'http://fake/foo']

    resolved = SourceInstall()
    resolved.manifest_url = 'http://fake/foo'
    resolved.check_presence_command = """#!/bin/bash
exit 0
"""
    commands = installer.get_install_command([resolved])
    assert not (commands)
Exemplo n.º 7
0
def test_SourceInstaller_resolve():
    from rosdep2.platforms.source import SourceInstaller, InvalidData
    test_dir = get_test_dir()

    url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
    md5sum_good = REP112_MD5SUM
    md5sum_bad = 'fake'

    installer = SourceInstaller()
    try:
        installer.resolve({})
        assert False, "should have raised"
    except InvalidData:
        pass
    try:
        installer.resolve(dict(uri=url, md5sum=md5sum_bad))
        assert False, "should have raised"
    except InvalidData:
        pass
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))

    assert type(resolved) == list
    assert len(resolved) == 1
    # test for reinstall (to check the depends in rdmanifest)
    dependencies = installer.get_depends(dict(uri=url, md5sum=md5sum_good))
    assert dependencies == [
        'checkinstall'
    ], "Dependencies should resolve to checkinstall listed in the rdmanifest."
    resolved = resolved[0]

    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command

    # test again to activate caching
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
    assert type(resolved) == list, "Cache should also return a list"
    assert len(resolved) == 1
    resolved = resolved[0]
    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command
Exemplo n.º 8
0
def test_SourceInstaller_resolve():
    from rosdep2.platforms.source import SourceInstaller, InvalidData
    test_dir = get_test_dir()

    url = 'file://%s' % os.path.join(test_dir, 'rep112-example.rdmanifest')
    md5sum_good = REP112_MD5SUM
    md5sum_bad = 'fake'

    installer = SourceInstaller()
    try:
        installer.resolve({})
        assert False, "should have raised"
    except InvalidData:
        pass
    try:
        installer.resolve(dict(uri=url, md5sum=md5sum_bad))
        assert False, "should have raised"
    except InvalidData:
        pass
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
        
    assert type(resolved) == list
    assert len(resolved) == 1
    # test for reinstall (to check the depends in rdmanifest)
    dependencies = installer.get_depends(dict(uri=url, md5sum=md5sum_good))
    assert dependencies == ['checkinstall'], "Dependencies should resolve to checkinstall listed in the rdmanifest."
    resolved = resolved[0]

    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command

    # test again to activate caching
    resolved = installer.resolve(dict(uri=url, md5sum=md5sum_good))
    assert type(resolved) == list, "Cache should also return a list"
    assert len(resolved) == 1
    resolved = resolved[0]
    assert resolved.install_command == rep122_install_command
    assert resolved.check_presence_command == rep122_check_presence_command