aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_blame.py
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2023-10-10 01:42:53 +0100
committerGitHub <noreply@github.com>2023-10-10 01:42:53 +0100
commit89d51e87a3fe4bdcb1efabbe7a4923958998a61c (patch)
tree64f4a27d45553fc977a621b4f356134f585d17ba /tests/test_blame.py
parentcaca4f6936ed1226ef20792542af5189cc110078 (diff)
parentb0d5a8dcbc033bab0a97383b2082e09ccf698dd7 (diff)
downloadgit-deps-89d51e87a3fe4bdcb1efabbe7a4923958998a61c.tar.gz
Merge pull request #127 from wetneb/1-blame-via-pygitmaster
Blame via pygit2 instead of subprocess
Diffstat (limited to 'tests/test_blame.py')
-rw-r--r--tests/test_blame.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_blame.py b/tests/test_blame.py
new file mode 100644
index 0000000..410e7de
--- /dev/null
+++ b/tests/test_blame.py
@@ -0,0 +1,24 @@
+
+from git_deps.blame import blame_via_subprocess, BlameHunk, GitRef
+
+def test_blame_via_subprocess():
+ hunks = list(blame_via_subprocess(
+ 'INSTALL.md',
+ '04f5c095d4eccf5808db6dbf90c31a535f7f371c',
+ 12, 4))
+
+ expected_hunks = [
+ BlameHunk(
+ GitRef('6e23a48f888a355ad7e101c797ce1b66c4b7b86a'),
+ orig_start_line_number=12,
+ final_start_line_number=12,
+ lines_in_hunk=2),
+ BlameHunk(
+ GitRef('2c9d23b0291157eb1096384ff76e0122747b9bdf'),
+ orig_start_line_number=10,
+ final_start_line_number=14,
+ lines_in_hunk=2)
+ ]
+
+ assert hunks == expected_hunks
+