summaryrefslogtreecommitdiff
path: root/git/test/test_git.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/test_git.py')
-rw-r--r--git/test/test_git.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 51da5f97..f7442257 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -22,6 +22,7 @@ from git import (
GitCommandNotFound,
Repo
)
+from git.cmd import _deplete_buffer
from gitdb.test.lib import with_rw_directory
from git.compat import PY3
@@ -204,3 +205,19 @@ class TestGit(TestBase):
# end
# end
# end if select.poll exists
+
+ def test_dispatch_lines(self):
+ for path, line_count in ((fixture_path('issue-301_stderr'), 5002),
+ (fixture_path('issue-301_FETCH_HEAD'), 5001)):
+ count = [0]
+ def counter(line):
+ count[0] += 1
+
+ fd = os.open(path, os.O_RDONLY)
+ buf_list = [b'']
+ lines_parsed = _deplete_buffer(fd, counter, buf_list)
+ os.close(fd)
+
+ assert lines_parsed == line_count
+ assert count[0] == line_count
+ # end for each file to read