Skip to content

Commit 6c6ae79

Browse files
ghickmanByron
authored andcommitted
Add a fixture to test incremental blame output for git 2.11.1+
1 parent 46c4ec2 commit 6c6ae79

File tree

2 files changed

+53
-18
lines changed

2 files changed

+53
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
82b8902e033430000481eb355733cd7065342037 2 2 1
2+
author Sebastian Thiel
3+
author-mail <byronimo@gmail.com>
4+
author-time 1270634931
5+
author-tz +0200
6+
committer Sebastian Thiel
7+
committer-mail <byronimo@gmail.com>
8+
committer-time 1270634931
9+
committer-tz +0200
10+
summary Used this release for a first beta of the 0.2 branch of development
11+
previous 501bf602abea7d21c3dbb409b435976e92033145 AUTHORS
12+
filename AUTHORS
13+
82b8902e033430000481eb355733cd7065342037 14 14 1
14+
previous 501bf602abea7d21c3dbb409b435976e92033145 AUTHORS
15+
filename AUTHORS
16+
c76852d0bff115720af3f27acdb084c59361e5f6 1 1 1
17+
author Michael Trier
18+
author-mail <mtrier@gmail.com>
19+
author-time 1232829627
20+
author-tz -0500
21+
committer Michael Trier
22+
committer-mail <mtrier@gmail.com>
23+
committer-time 1232829627
24+
committer-tz -0500
25+
summary Lots of spring cleaning and added in Sphinx documentation.
26+
previous bcd57e349c08bd7f076f8d6d2f39b702015358c1 AUTHORS
27+
filename AUTHORS
28+
c76852d0bff115720af3f27acdb084c59361e5f6 2 3 11
29+
previous bcd57e349c08bd7f076f8d6d2f39b702015358c1 AUTHORS
30+
filename AUTHORS
31+
c76852d0bff115720af3f27acdb084c59361e5f6 13 15 2
32+
previous bcd57e349c08bd7f076f8d6d2f39b702015358c1 AUTHORS
33+
filename AUTHORS

git/test/test_repo.py

+20-18
Original file line numberDiff line numberDiff line change
@@ -387,24 +387,26 @@ def test_blame_real(self):
387387

388388
@patch.object(Git, '_call_process')
389389
def test_blame_incremental(self, git):
390-
git.return_value = fixture('blame_incremental')
391-
blame_output = self.rorepo.blame_incremental('9debf6b0aafb6f7781ea9d1383c86939a1aacde3', 'AUTHORS')
392-
blame_output = list(blame_output)
393-
self.assertEqual(len(blame_output), 5)
394-
395-
# Check all outputted line numbers
396-
ranges = flatten([entry.linenos for entry in blame_output])
397-
self.assertEqual(ranges, flatten([range(2, 3), range(14, 15), range(1, 2), range(3, 14), range(15, 17)]))
398-
399-
commits = [entry.commit.hexsha[:7] for entry in blame_output]
400-
self.assertEqual(commits, ['82b8902', '82b8902', 'c76852d', 'c76852d', 'c76852d'])
401-
402-
# Original filenames
403-
self.assertSequenceEqual([entry.orig_path for entry in blame_output], [u'AUTHORS'] * len(blame_output))
404-
405-
# Original line numbers
406-
orig_ranges = flatten([entry.orig_linenos for entry in blame_output])
407-
self.assertEqual(orig_ranges, flatten([range(2, 3), range(14, 15), range(1, 2), range(2, 13), range(13, 15)])) # noqa E501
390+
# loop over two fixtures, create a test fixture for 2.11.1+ syntax
391+
for git_fixture in ('blame_incremental', 'blame_incremental_2.11.1_plus'):
392+
git.return_value = fixture(git_fixture)
393+
blame_output = self.rorepo.blame_incremental('9debf6b0aafb6f7781ea9d1383c86939a1aacde3', 'AUTHORS')
394+
blame_output = list(blame_output)
395+
self.assertEqual(len(blame_output), 5)
396+
397+
# Check all outputted line numbers
398+
ranges = flatten([entry.linenos for entry in blame_output])
399+
self.assertEqual(ranges, flatten([range(2, 3), range(14, 15), range(1, 2), range(3, 14), range(15, 17)]))
400+
401+
commits = [entry.commit.hexsha[:7] for entry in blame_output]
402+
self.assertEqual(commits, ['82b8902', '82b8902', 'c76852d', 'c76852d', 'c76852d'])
403+
404+
# Original filenames
405+
self.assertSequenceEqual([entry.orig_path for entry in blame_output], [u'AUTHORS'] * len(blame_output))
406+
407+
# Original line numbers
408+
orig_ranges = flatten([entry.orig_linenos for entry in blame_output])
409+
self.assertEqual(orig_ranges, flatten([range(2, 3), range(14, 15), range(1, 2), range(2, 13), range(13, 15)])) # noqa E501
408410

409411
@patch.object(Git, '_call_process')
410412
def test_blame_complex_revision(self, git):

0 commit comments

Comments
 (0)