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_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(mock_method, mock_is_pip_installed): mock_is_pip_installed.return_value = True 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', 'pip', 'install', '-U', 'a'], ['sudo', '-H', 'pip', 'install', '-U', 'b']] val = installer.get_install_command(['whatever'], interactive=False) assert val == expected, val expected = [['sudo', '-H', 'pip', 'install', '-U', 'a'], ['sudo', '-H', 'pip', 'install', '-U', 'b']] val = installer.get_install_command(['whatever'], interactive=True) assert val == expected, val