summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/git/test_blob.py14
-rw-r--r--test/git/test_commit.py24
-rw-r--r--test/git/test_git.py4
-rw-r--r--test/git/test_head.py2
-rw-r--r--test/git/test_repo.py60
-rw-r--r--test/git/test_tag.py4
-rw-r--r--test/git/test_tree.py24
7 files changed, 66 insertions, 66 deletions
diff --git a/test/git/test_blob.py b/test/git/test_blob.py
index 2f43e82f..fb7fc890 100644
--- a/test/git/test_blob.py
+++ b/test/git/test_blob.py
@@ -12,7 +12,7 @@ class TestBlob(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_return_blob_contents(self, git):
git.return_value = fixture('cat_file_blob')
blob = Blob(self.repo, **{'id': 'abc'})
@@ -20,7 +20,7 @@ class TestBlob(object):
assert_true(git.called)
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_return_blob_contents_with_newline(self, git):
git.return_value = fixture('cat_file_blob_nl')
blob = Blob(self.repo, **{'id': 'abc'})
@@ -28,7 +28,7 @@ class TestBlob(object):
assert_true(git.called)
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_cache_data(self, git):
git.return_value = fixture('cat_file_blob')
blob = Blob(self.repo, **{'id': 'abc'})
@@ -38,7 +38,7 @@ class TestBlob(object):
assert_equal(git.call_count, 1)
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_return_file_size(self, git):
git.return_value = fixture('cat_file_blob_size')
blob = Blob(self.repo, **{'id': 'abc'})
@@ -46,12 +46,12 @@ class TestBlob(object):
assert_true(git.called)
assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_cache_file_size(self, git):
git.return_value = fixture('cat_file_blob_size')
blob = Blob(self.repo, **{'id': 'abc'})
assert_equal(11, blob.size)
- assert_equal(11, blob.size)
+ assert_equal(11, blob.size)
assert_true(git.called)
assert_equal(git.call_count, 1)
assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
@@ -64,7 +64,7 @@ class TestBlob(object):
blob = Blob(self.repo, **{'id': 'abc'})
assert_equal("text/plain", blob.mime_type)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_should_display_blame_information(self, git):
git.return_value = fixture('blame')
b = Blob.blame(self.repo, 'master', 'lib/git.py')
diff --git a/test/git/test_commit.py b/test/git/test_commit.py
index 583a5079..e9336f2c 100644
--- a/test/git/test_commit.py
+++ b/test/git/test_commit.py
@@ -11,7 +11,7 @@ class TestCommit(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_bake(self, git):
git.return_value = fixture('rev_list_single')
@@ -24,12 +24,12 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_id_abbrev(self, git):
git.return_value = fixture('rev_list_commit_idabbrev')
assert_equal('80f136f', self.repo.commit('80f136f500dfdb8c3e8abf4ae716f875f0a1b57f').id_abbrev)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff(self, git):
git.return_value = fixture('diff_p')
@@ -54,7 +54,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', 'master'), {'full_index': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff_with_two_commits(self, git):
git.return_value = fixture('diff_2')
@@ -65,7 +65,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5'), {'full_index': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff_with_files(self, git):
git.return_value = fixture('diff_f')
@@ -77,7 +77,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', '59ddc32', '--', 'lib'), {'full_index': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff_with_two_commits_and_files(self, git):
git.return_value = fixture('diff_2f')
@@ -89,7 +89,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diffs(self, git):
git.return_value = fixture('diff_p')
@@ -117,7 +117,7 @@ class TestCommit(object):
'91169e1f5fa4de2eaea3f176461f5dc784796769',
), {'full_index': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diffs_on_initial_import(self, git):
git.return_value = fixture('diff_i')
@@ -144,7 +144,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diffs_on_initial_import_with_empty_commit(self, git):
git.return_value = fixture('show_empty_commit')
@@ -156,7 +156,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diffs_with_mode_only_change(self, git):
git.return_value = fixture('diff_mode_only')
@@ -171,7 +171,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769'), {'full_index': True, 'pretty': 'raw'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_stats(self, git):
git.return_value = fixture('diff_numstat')
@@ -186,7 +186,7 @@ class TestCommit(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat': True}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_rev_list_bisect_all(self, git):
"""
'git rev-list --bisect-all' returns additional information
diff --git a/test/git/test_git.py b/test/git/test_git.py
index 4618ecf2..3a3dc564 100644
--- a/test/git/test_git.py
+++ b/test/git/test_git.py
@@ -13,7 +13,7 @@ class TestGit(object):
base = os.path.join(os.path.dirname(__file__), "../..")
self.git = Git(base)
- @patch(Git, 'execute')
+ @patch_object(Git, 'execute')
def test_call_process_calls_execute(self, git):
git.return_value = ''
self.git.version()
@@ -51,7 +51,7 @@ class TestGit(object):
output = self.git.execute(["cat", "/bin/bash"])
assert_true(len(output) > 4096) # at least 4k
- @patch(Git, 'execute')
+ @patch_object(Git, 'execute')
def test_it_ignores_false_kwargs(self, git):
# this_should_not_be_ignored=False implies it *should* be ignored
output = self.git.version(pass_this_kwarg=False)
diff --git a/test/git/test_head.py b/test/git/test_head.py
index ecac13c8..669665c0 100644
--- a/test/git/test_head.py
+++ b/test/git/test_head.py
@@ -11,7 +11,7 @@ class TestHead(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_repr(self, git):
git.return_value = fixture('for_each_ref')
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 669a8f62..aca63843 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -33,7 +33,7 @@ class TestRepo(object):
for head in self.repo.heads:
assert_equal(Head, head.__class__)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_heads_should_populate_head_data(self, git):
git.return_value = fixture('for_each_ref')
@@ -44,7 +44,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('for_each_ref', 'refs/heads'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_commits(self, git):
git.return_value = fixture('rev_list')
@@ -72,7 +72,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('rev_list', 'master'), {'skip': 0, 'pretty': 'raw', 'max_count': 10}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_commit_count(self, git):
git.return_value = fixture('rev_list_count')
@@ -81,7 +81,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('rev_list', 'master'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_commit(self, git):
git.return_value = fixture('rev_list_single')
@@ -92,7 +92,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_tree(self, git):
git.return_value = fixture('ls_tree_a')
@@ -104,7 +104,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_blob(self, git):
git.return_value = fixture('cat_file_blob')
@@ -114,8 +114,8 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
- @patch(Repo, '__init__')
- @patch(Git, '_call_process')
+ @patch_object(Repo, '__init__')
+ @patch_object(Git, '_call_process')
def test_init_bare(self, repo, git):
git.return_value = True
@@ -126,8 +126,8 @@ class TestRepo(object):
assert_true(repo.called)
assert_equal(repo.call_args, (('repos/foo/bar.git',), {}))
- @patch(Repo, '__init__')
- @patch(Git, '_call_process')
+ @patch_object(Repo, '__init__')
+ @patch_object(Git, '_call_process')
def test_init_bare_with_options(self, repo, git):
git.return_value = True
@@ -138,8 +138,8 @@ class TestRepo(object):
assert_true(repo.called)
assert_equal(repo.call_args, (('repos/foo/bar.git',), {}))
- @patch(Repo, '__init__')
- @patch(Git, '_call_process')
+ @patch_object(Repo, '__init__')
+ @patch_object(Git, '_call_process')
def test_fork_bare(self, repo, git):
git.return_value = None
@@ -150,8 +150,8 @@ class TestRepo(object):
assert_equal(git.call_args, (('clone', path, 'repos/foo/bar.git'), {'bare': True}))
assert_true(repo.called)
- @patch(Repo, '__init__')
- @patch(Git, '_call_process')
+ @patch_object(Repo, '__init__')
+ @patch_object(Git, '_call_process')
def test_fork_bare_with_options(self, repo, git):
git.return_value = None
@@ -163,7 +163,7 @@ class TestRepo(object):
{'bare': True, 'template': '/awesome'}))
assert_true(repo.called)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff(self, git):
self.repo.diff('master^', 'master')
@@ -180,7 +180,7 @@ class TestRepo(object):
assert_true(git.called)
assert_equal(git.call_args, (('diff', 'master^', 'master', '--', 'foo/bar', 'foo/baz'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_diff(self, git):
git.return_value = fixture('diff_p')
@@ -194,7 +194,7 @@ class TestRepo(object):
def test_archive_tar_gz(self):
self.repo.archive_tar_gz
- @patch('git.utils', 'touch')
+ @patch('git.utils.touch')
def test_enable_daemon_serve(self, touch):
self.repo.daemon_serve = False
assert_false(self.repo.daemon_serve)
@@ -203,8 +203,8 @@ class TestRepo(object):
self.repo.daemon_serve = True
assert_true(self.repo.daemon_serve)
- # @patch(os.path, 'exists')
- # @patch('__builtin__', 'open')
+ # @patch_object(os.path, 'exists')
+ # @patch_object('__builtin__', 'open')
# def test_alternates_with_two_alternates(self, exists, read):
# # File.expects(:exist?).with("#{absolute_project_path}/.git/objects/info/alternates").returns(true)
# # File.expects(:read).returns("/path/to/repo1/.git/objects\n/path/to/repo2.git/objects\n")
@@ -216,14 +216,14 @@ class TestRepo(object):
# assert_true(exists.called)
# assert_true(read.called)
#
- @patch(os.path, 'exists')
+ @patch_object(os.path, 'exists')
def test_alternates_no_file(self, os):
os.return_value = False
assert_equal([], self.repo.alternates)
assert_true(os.called)
- # @patch(os.path, 'exists')
+ # @patch_object(os.path, 'exists')
# def test_alternates_setter_ok(self, os):
# os.return_value = True
# alts = ['/path/to/repo.git/objects', '/path/to/repo2.git/objects']
@@ -236,7 +236,7 @@ class TestRepo(object):
# # assert_equal(os.call_args, ((alts,), {}))
# # for alt in alts:
#
- # @patch(os.path, 'exists')
+ # @patch_object(os.path, 'exists')
# @raises(NoSuchPathError)
# def test_alternates_setter_bad(self, os):
# os.return_value = False
@@ -249,7 +249,7 @@ class TestRepo(object):
# assert_true(os.called)
# assert_equal(os.call_args, (alt, {}))
- @patch(os, 'remove')
+ @patch_object(os, 'remove')
def test_alternates_setter_empty(self, os):
self.repo.alternates = []
assert_true(os.called)
@@ -258,7 +258,7 @@ class TestRepo(object):
path = os.path.join(os.path.abspath(GIT_REPO), '.git')
assert_equal('<git.Repo "%s">' % path, repr(self.repo))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_log(self, git):
git.return_value = fixture('rev_list')
assert_equal('4c8124ffcf4039d292442eeccabdeca5af5c5017', self.repo.log()[0].id)
@@ -267,15 +267,15 @@ class TestRepo(object):
assert_equal(git.call_count, 2)
assert_equal(git.call_args, (('log', 'master'), {'pretty': 'raw'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_log_with_path_and_options(self, git):
git.return_value = fixture('rev_list')
self.repo.log('master', 'file.rb', **{'max_count': 1})
assert_true(git.called)
assert_equal(git.call_args, (('log', 'master', '--', 'file.rb'), {'pretty': 'raw', 'max_count': 1}))
- # @patch(Git, '_call_process')
- # @patch(Git, '_call_process')
+ # @patch_object(Git, '_call_process')
+ # @patch_object(Git, '_call_process')
# def test_commit_deltas_from_nothing_new(self, gitb, gita):
# gitb.return_value = fixture("rev_list_delta_b")
# gita.return_value = fixture("rev_list_delta_a")
@@ -305,21 +305,21 @@ class TestRepo(object):
self.repo.bare = True
assert_false(self.repo.is_dirty)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_is_dirty_with_clean_working_dir(self, git):
self.repo.bare = False
git.return_value = ''
assert_false(self.repo.is_dirty)
assert_equal(git.call_args, (('diff', 'HEAD'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_is_dirty_with_dirty_working_dir(self, git):
self.repo.bare = False
git.return_value = '''-aaa\n+bbb'''
assert_true(self.repo.is_dirty)
assert_equal(git.call_args, (('diff', 'HEAD'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_active_branch(self, git):
git.return_value = 'refs/heads/major-refactoring'
assert_equal(self.repo.active_branch, 'major-refactoring')
diff --git a/test/git/test_tag.py b/test/git/test_tag.py
index 3d33d7e3..a8b128b1 100644
--- a/test/git/test_tag.py
+++ b/test/git/test_tag.py
@@ -12,7 +12,7 @@ class TestTag(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_list_from_string(self, git):
git.return_value = fixture('for_each_ref_tags')
@@ -25,7 +25,7 @@ class TestTag(object):
assert_true(git.called)
assert_equal(git.call_args, (('for_each_ref', 'refs/tags'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_repr(self, git):
git.return_value = fixture('for_each_ref')
diff --git a/test/git/test_tree.py b/test/git/test_tree.py
index fa3337c9..487c5dad 100644
--- a/test/git/test_tree.py
+++ b/test/git/test_tree.py
@@ -11,7 +11,7 @@ class TestTree(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_contents_should_cache(self, git):
git.return_value = fixture('ls_tree_a') + fixture('ls_tree_b')
@@ -54,8 +54,8 @@ class TestTree(object):
def test_content_from_string_invalid_type_should_raise(self):
Tree.content_from_string(None, "040000 bogus 650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44 test")
- @patch(Blob, 'size')
- @patch(Git, '_call_process')
+ @patch_object(Blob, 'size')
+ @patch_object(Git, '_call_process')
def test_slash(self, blob, git):
git.return_value = fixture('ls_tree_a')
blob.return_value = 1
@@ -68,8 +68,8 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Blob, 'size')
- @patch(Git, '_call_process')
+ @patch_object(Blob, 'size')
+ @patch_object(Git, '_call_process')
def test_slash_with_zero_length_file(self, blob, git):
git.return_value = fixture('ls_tree_a')
blob.return_value = 0
@@ -82,7 +82,7 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_slash_with_commits(self, git):
git.return_value = fixture('ls_tree_commit')
@@ -95,8 +95,8 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Blob, 'size')
- @patch(Git, '_call_process')
+ @patch_object(Blob, 'size')
+ @patch_object(Git, '_call_process')
def test_dict(self, blob, git):
git.return_value = fixture('ls_tree_a')
blob.return_value = 1
@@ -109,8 +109,8 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Blob, 'size')
- @patch(Git, '_call_process')
+ @patch_object(Blob, 'size')
+ @patch_object(Git, '_call_process')
def test_dict_with_zero_length_file(self, blob, git):
git.return_value = fixture('ls_tree_a')
blob.return_value = 0
@@ -123,7 +123,7 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
def test_dict_with_commits(self, git):
git.return_value = fixture('ls_tree_commit')
@@ -136,7 +136,7 @@ class TestTree(object):
assert_true(git.called)
assert_equal(git.call_args, (('ls_tree', 'master'), {}))
- @patch(Git, '_call_process')
+ @patch_object(Git, '_call_process')
@raises(KeyError)
def test_dict_with_non_existant_file(self, git):
git.return_value = fixture('ls_tree_commit')