Exemplo n.º 1
0
def test_ubuntu():
    import rospkg.os_detect
    from rospkg.os_detect import LsbDetect, OsDetect, OsNotDetected
    test_dir = os.path.join(get_test_dir(), 'ubuntu')
    rospkg.os_detect._lsb_release = os.path.join(test_dir, 'lsb_release')
    detect = OsDetect().get_detector('ubuntu')
    assert detect.is_os()
    assert detect.get_version() == '10.04'
    assert detect.get_codename() == 'lucid'

    # test freely
    if not detect.is_os():
        try:
            detect.get_version()
            assert False
        except OsNotDetected: pass
        try:
            detect.get_codename()
            assert False
        except OsNotDetected: pass