Example #1
0
 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
Example #2
0
 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
Example #3
0
    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', 'pip', 'install', '-U', 'a'],
                    ['sudo', 'pip', 'install', '-U', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val
        expected = [['sudo', 'pip', 'install', '-U', 'a'],
                    ['sudo', 'pip', 'install', '-U', 'b']]
        val = installer.get_install_command(['whatever'], interactive=True)
        assert val == expected, val
Example #4
0
    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', 'pip', 'install', '-U', 'a'],
                    ['sudo', 'pip', 'install', '-U', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val
        expected = [['sudo', 'pip', 'install', '-U', 'a'],
                    ['sudo', 'pip', 'install', '-U', 'b']]
        val = installer.get_install_command(['whatever'], interactive=True)
        assert val == expected, val