Beispiel #1
0
    def test_check_pip_is_installed_failure(self, mock_sys_exit):
        if six.PY3:
            module_name = 'builtins.__import__'
        else:
            module_name = '__builtin__.__import__'

        with mock.patch(module_name) as mock_import:
            mock_import.side_effect = ImportError('not found')

            self.assertEqual(mock_sys_exit.call_count, 0)
            check_pip_is_installed()
            self.assertEqual(mock_sys_exit.call_count, 1)
            self.assertEqual(mock_sys_exit.call_args_list[0][0], (1, ))
Beispiel #2
0
 def test_check_pip_is_installed_success(self):
     self.assertTrue(check_pip_is_installed())