예제 #1
0
def test_brew_detect():
    from rosdep2.platforms.osx import brew_detect

    m = Mock()
    m.return_value = ''
    val = brew_detect([], exec_fn=m)
    assert val == [], val

    m = Mock()
    m.return_value = ''
    val = brew_detect(make_resolutions(['tinyxml']), exec_fn=m)
    assert val == [], val
    # make sure our test harness is based on the same implementation
    m.assert_called_with(['brew', 'list'])
    assert m.call_args_list == [call(['brew', 'list'])], m.call_args_list

    m = Mock()
    m.side_effect = brew_command
    val = brew_detect(make_resolutions(
        ['apt', 'subversion', 'python', 'bazaar']),
                      exec_fn=m)
    # make sure it preserves order
    expected = make_resolutions(['subversion', 'bazaar'])
    assert set(val) == set(expected), val
    assert val == expected, val
    assert len(val) == len(set(val)), val
예제 #2
0
def test_brew_detect():
    from rosdep2.platforms.osx import brew_detect

    m = Mock()
    m.return_value = ''
    val = brew_detect([], exec_fn=m)
    assert val == [], val

    m = Mock()
    m.return_value = ''
    val = brew_detect(['tinyxml'], exec_fn=m)
    assert val == [], val
    # make sure our test harness is based on the same implementation
    m.assert_called_with(['brew', 'list'])

    with open(os.path.join(get_test_dir(), 'brew-list-output'), 'r') as f:
        m.return_value = f.read()
    val = brew_detect(['apt', 'subversion', 'python', 'bazaar'], exec_fn=m)
    # make sure it preserves order
    assert set(val) == set(['subversion', 'bazaar'])
    assert len(val) == len(set(val))
예제 #3
0
def test_brew_detect():
    from rosdep2.platforms.osx import brew_detect
    
    m = Mock()
    m.return_value = ''
    val = brew_detect([], exec_fn=m)
    assert val == [], val

    m = Mock()
    m.return_value = ''
    val = brew_detect(['tinyxml'], exec_fn=m)
    assert val == [], val
    # make sure our test harness is based on the same implementation
    m.assert_called_with(['brew', 'list'])

    with open(os.path.join(get_test_dir(), 'brew-list-output'), 'r') as f:
        m.return_value = f.read()
    val = brew_detect(['apt', 'subversion', 'python', 'bazaar'], exec_fn=m)
    # make sure it preserves order
    assert set(val) == set(['subversion', 'bazaar'])
    assert len(val) == len(set(val))
예제 #4
0
def test_brew_detect():
    from rosdep2.platforms.osx import brew_detect

    m = Mock()
    m.return_value = ''
    val = brew_detect([], exec_fn=m)
    assert val == [], val

    m = Mock()
    m.return_value = ''
    val = brew_detect(make_resolutions(['tinyxml']), exec_fn=m)
    assert val == [], val
    # make sure our test harness is based on the same implementation
    m.assert_called_with(['brew', 'list'])
    assert m.call_args_list == [call(['brew', 'list'])], m.call_args_list

    m = Mock()
    m.side_effect = brew_command
    val = brew_detect(make_resolutions(['apt', 'subversion', 'python', 'bazaar']), exec_fn=m)
    # make sure it preserves order
    expected = make_resolutions(['subversion', 'bazaar'])
    assert set(val) == set(expected), val
    assert val == expected, val
    assert len(val) == len(set(val)), val