def test_no_pip(mock_method): mock_method.return_value = False try: installer = PipInstaller() installer.get_install_command(['whatever']) assert False, "should have raised" except InstallFailed: pass
def test(mock_method, mock_get_pip_command): mock_get_pip_command.return_value = ['mock-pip'] installer = PipInstaller() mock_method.return_value = [] assert [] == installer.get_install_command(['fake']) # no interactive option with PIP mock_method.return_value = ['a', 'b'] expected = [['sudo', '-H', 'mock-pip', 'install', '-U', 'a'], ['sudo', '-H', 'mock-pip', 'install', '-U', 'b']] val = installer.get_install_command(['whatever'], interactive=False) assert val == expected, val expected = [['sudo', '-H', 'mock-pip', 'install', '-U', 'a'], ['sudo', '-H', 'mock-pip', 'install', '-U', 'b']] val = installer.get_install_command(['whatever'], interactive=True) assert val == expected, val
def test_PipInstaller_get_depends(): # make sure PipInstaller supports depends from rosdep2.platforms.pip import PipInstaller installer = PipInstaller() assert ['foo'] == installer.get_depends(dict(depends=['foo']))