Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc1fcf3

Browse files
apollo13empty
authored andcommitted
Get compatible with mock0.4 (to some extend ;)). Just that Michael
doesn't need to do the same boring replacing I did. (cherry picked from commit 10c62aa69193a8bc7b46ca24c2ad1d5008489665)
1 parent b00f368 commit dc1fcf3

File tree

7 files changed

+66
-66
lines changed

7 files changed

+66
-66
lines changed

test/git/test_blob.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ class TestBlob(object):
1212
def setup(self):
1313
self.repo = Repo(GIT_REPO)
1414

15-
@patch(Git, '_call_process')
15+
@patch_object(Git, '_call_process')
1616
def test_should_return_blob_contents(self, git):
1717
git.return_value = fixture('cat_file_blob')
1818
blob = Blob(self.repo, **{'id': 'abc'})
1919
assert_equal("Hello world", blob.data)
2020
assert_true(git.called)
2121
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
2222

23-
@patch(Git, '_call_process')
23+
@patch_object(Git, '_call_process')
2424
def test_should_return_blob_contents_with_newline(self, git):
2525
git.return_value = fixture('cat_file_blob_nl')
2626
blob = Blob(self.repo, **{'id': 'abc'})
2727
assert_equal("Hello world\n", blob.data)
2828
assert_true(git.called)
2929
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
3030

31-
@patch(Git, '_call_process')
31+
@patch_object(Git, '_call_process')
3232
def test_should_cache_data(self, git):
3333
git.return_value = fixture('cat_file_blob')
3434
blob = Blob(self.repo, **{'id': 'abc'})
@@ -38,20 +38,20 @@ def test_should_cache_data(self, git):
3838
assert_equal(git.call_count, 1)
3939
assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
4040

41-
@patch(Git, '_call_process')
41+
@patch_object(Git, '_call_process')
4242
def test_should_return_file_size(self, git):
4343
git.return_value = fixture('cat_file_blob_size')
4444
blob = Blob(self.repo, **{'id': 'abc'})
4545
assert_equal(11, blob.size)
4646
assert_true(git.called)
4747
assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
4848

49-
@patch(Git, '_call_process')
49+
@patch_object(Git, '_call_process')
5050
def test_should_cache_file_size(self, git):
5151
git.return_value = fixture('cat_file_blob_size')
5252
blob = Blob(self.repo, **{'id': 'abc'})
5353
assert_equal(11, blob.size)
54-
assert_equal(11, blob.size)
54+
assert_equal(11, blob.size)
5555
assert_true(git.called)
5656
assert_equal(git.call_count, 1)
5757
assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
@@ -64,7 +64,7 @@ def test_mime_type_should_return_text_plain_for_unknown_types(self):
6464
blob = Blob(self.repo, **{'id': 'abc'})
6565
assert_equal("text/plain", blob.mime_type)
6666

67-
@patch(Git, '_call_process')
67+
@patch_object(Git, '_call_process')
6868
def test_should_display_blame_information(self, git):
6969
git.return_value = fixture('blame')
7070
b = Blob.blame(self.repo, 'master', 'lib/git.py')

test/git/test_commit.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestCommit(object):
1111
def setup(self):
1212
self.repo = Repo(GIT_REPO)
1313

14-
@patch(Git, '_call_process')
14+
@patch_object(Git, '_call_process')
1515
def test_bake(self, git):
1616
git.return_value = fixture('rev_list_single')
1717

@@ -24,12 +24,12 @@ def test_bake(self, git):
2424
assert_true(git.called)
2525
assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1}))
2626

27-
@patch(Git, '_call_process')
27+
@patch_object(Git, '_call_process')
2828
def test_id_abbrev(self, git):
2929
git.return_value = fixture('rev_list_commit_idabbrev')
3030
assert_equal('80f136f', self.repo.commit('80f136f500dfdb8c3e8abf4ae716f875f0a1b57f').id_abbrev)
3131

32-
@patch(Git, '_call_process')
32+
@patch_object(Git, '_call_process')
3333
def test_diff(self, git):
3434
git.return_value = fixture('diff_p')
3535

@@ -54,7 +54,7 @@ def test_diff(self, git):
5454
assert_true(git.called)
5555
assert_equal(git.call_args, (('diff', 'master'), {'full_index': True}))
5656

57-
@patch(Git, '_call_process')
57+
@patch_object(Git, '_call_process')
5858
def test_diff_with_two_commits(self, git):
5959
git.return_value = fixture('diff_2')
6060

@@ -65,7 +65,7 @@ def test_diff_with_two_commits(self, git):
6565
assert_true(git.called)
6666
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5'), {'full_index': True}))
6767

68-
@patch(Git, '_call_process')
68+
@patch_object(Git, '_call_process')
6969
def test_diff_with_files(self, git):
7070
git.return_value = fixture('diff_f')
7171

@@ -77,7 +77,7 @@ def test_diff_with_files(self, git):
7777
assert_true(git.called)
7878
assert_equal(git.call_args, (('diff', '59ddc32', '--', 'lib'), {'full_index': True}))
7979

80-
@patch(Git, '_call_process')
80+
@patch_object(Git, '_call_process')
8181
def test_diff_with_two_commits_and_files(self, git):
8282
git.return_value = fixture('diff_2f')
8383

@@ -89,7 +89,7 @@ def test_diff_with_two_commits_and_files(self, git):
8989
assert_true(git.called)
9090
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True}))
9191

92-
@patch(Git, '_call_process')
92+
@patch_object(Git, '_call_process')
9393
def test_diffs(self, git):
9494
git.return_value = fixture('diff_p')
9595

@@ -117,7 +117,7 @@ def test_diffs(self, git):
117117
'91169e1f5fa4de2eaea3f176461f5dc784796769',
118118
), {'full_index': True}))
119119

120-
@patch(Git, '_call_process')
120+
@patch_object(Git, '_call_process')
121121
def test_diffs_on_initial_import(self, git):
122122
git.return_value = fixture('diff_i')
123123

@@ -144,7 +144,7 @@ def test_diffs_on_initial_import(self, git):
144144
assert_true(git.called)
145145
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
146146

147-
@patch(Git, '_call_process')
147+
@patch_object(Git, '_call_process')
148148
def test_diffs_on_initial_import_with_empty_commit(self, git):
149149
git.return_value = fixture('show_empty_commit')
150150

@@ -156,7 +156,7 @@ def test_diffs_on_initial_import_with_empty_commit(self, git):
156156
assert_true(git.called)
157157
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
158158

159-
@patch(Git, '_call_process')
159+
@patch_object(Git, '_call_process')
160160
def test_diffs_with_mode_only_change(self, git):
161161
git.return_value = fixture('diff_mode_only')
162162

@@ -171,7 +171,7 @@ def test_diffs_with_mode_only_change(self, git):
171171
assert_true(git.called)
172172
assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769'), {'full_index': True, 'pretty': 'raw'}))
173173

174-
@patch(Git, '_call_process')
174+
@patch_object(Git, '_call_process')
175175
def test_stats(self, git):
176176
git.return_value = fixture('diff_numstat')
177177

@@ -186,7 +186,7 @@ def test_stats(self, git):
186186
assert_true(git.called)
187187
assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat': True}))
188188

189-
@patch(Git, '_call_process')
189+
@patch_object(Git, '_call_process')
190190
def test_rev_list_bisect_all(self, git):
191191
"""
192192
'git rev-list --bisect-all' returns additional information

test/git/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def setup(self):
1313
base = os.path.join(os.path.dirname(__file__), "../..")
1414
self.git = Git(base)
1515

16-
@patch(Git, 'execute')
16+
@patch_object(Git, 'execute')
1717
def test_call_process_calls_execute(self, git):
1818
git.return_value = ''
1919
self.git.version()
@@ -51,7 +51,7 @@ def test_it_handles_large_input(self):
5151
output = self.git.execute(["cat", "/bin/bash"])
5252
assert_true(len(output) > 4096) # at least 4k
5353

54-
@patch(Git, 'execute')
54+
@patch_object(Git, 'execute')
5555
def test_it_ignores_false_kwargs(self, git):
5656
# this_should_not_be_ignored=False implies it *should* be ignored
5757
output = self.git.version(pass_this_kwarg=False)

test/git/test_head.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class TestHead(object):
1111
def setup(self):
1212
self.repo = Repo(GIT_REPO)
1313

14-
@patch(Git, '_call_process')
14+
@patch_object(Git, '_call_process')
1515
def test_repr(self, git):
1616
git.return_value = fixture('for_each_ref')
1717

0 commit comments

Comments
 (0)