예제 #1
0
 def test_git_mock_communicate(self, mock_popen):
     self.assertEqual(('foo', 'bar', 1), git.git1(['log']))
예제 #2
0
 def test_git_mock_returncode(self, mock_popen, mock_2):
     self.assertEqual(('foo', 'bar', 1), git.git1(['log']))
예제 #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" This calls the git Popen examples in different ways
    to show, what we need to test.
    We do need to test the Exceptions - see test_git.py """

import git
from git import GitCallException, GitErrorException
from pprint import pprint


print("-" * 30 + "Run git1 - successful:")
pprint(git.git1(['status', '-s']))

try:
    print("-" * 30 + "Run git1 - raise TypeError:")
    pprint(git.git1())
except TypeError as e:
    print e.message

try:
    print("-" * 30 + "Run git1 - raise GitCallException:")
    pprint(git.git1(''))
except GitCallException as e:
    print e.message

try:
    print("-" * 30 + "Run git1 - raise GitErrorException:")
    pprint(git.git1(['asdasdasd']))
except GitErrorException as e: