def test_create_import_error(self, mock_sh_import): mock_sh_import.side_effect = ImportError i = Virtualenv() path = i.create() warn = self.mocked_facio_hooks_python_virtualenv_Virtualenv_warning self.assertEqual(path, None) warn.assert_called_with("Please install virtualenv to use the " "python virtualenv hooks")
def test_create(self, mock_get_path, mock_input, mock_virtualenv): mock_get_path.return_value = '/foo/bar/baz' mock_input.return_value = '' i = Virtualenv() path = i.create() mock_virtualenv.assert_called_with('/foo/bar/baz', '--no-site-packages') self.assertEqual(path, '/foo/bar/baz')
def test_create_import_error(self, mock_sh_import): mock_sh_import.side_effect = ImportError i = Virtualenv() path = i.create() warn = self.mocked_facio_hooks_python_virtualenv_Virtualenv_warning self.assertEqual(path, None) warn.assert_called_with("Please install virtualenv to use the " "python virtualenv hooks")
def test_create(self, mock_get_path, mock_input, mock_virtualenv): mock_get_path.return_value = '/foo/bar/baz' mock_input.return_value = '' i = Virtualenv() path = i.create() mock_virtualenv.assert_called_with('/foo/bar/baz', '--no-site-packages') self.assertEqual(path, '/foo/bar/baz')
def test_create_venv_exception(self, mock_get_path, mock_input, mock_virtualenv): mock_get_path.return_value = '/foo/bar/baz' mock_virtualenv.side_effect = Exception i = Virtualenv() path = i.create() err = self.mocked_facio_hooks_python_virtualenv_Virtualenv_error self.assertEqual(path, None) err.assert_called_with("Failed to create virtual " "environment at: /foo/bar/baz")
def test_create_venv_exception(self, mock_get_path, mock_input, mock_virtualenv): mock_get_path.return_value = '/foo/bar/baz' mock_virtualenv.side_effect = Exception i = Virtualenv() path = i.create() err = self.mocked_facio_hooks_python_virtualenv_Virtualenv_error self.assertEqual(path, None) err.assert_called_with("Failed to create virtual " "environment at: /foo/bar/baz")