summaryrefslogtreecommitdiff
path: root/test/git/test_base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-22 12:28:04 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-22 12:30:47 +0200
commit4fe5cfa0e063a8d51a1eb6f014e2aaa994e5e7d4 (patch)
treeec39872b88729237e078d55b0c990a1f784360a6 /test/git/test_base.py
parentf62c9b9c0c9bda792c3fa531b18190e97eb53509 (diff)
downloadgitpython-4fe5cfa0e063a8d51a1eb6f014e2aaa994e5e7d4.tar.gz
Stream_data streams data to a given output stream most efficiently with a low memory footprint.
Still, the git-cat-file command keeps all data in an interal buffer instead of streaming it directly. This is a git design issue though, and will be hard to address without some proper git-hacking. Conflicts: lib/git/cmd.py
Diffstat (limited to 'test/git/test_base.py')
-rw-r--r--test/git/test_base.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py
index 4ad98d7f..b93e61c1 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -4,12 +4,15 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from test.testlib import *
-from git import *
import git.objects.base as base
import git.refs as refs
+import os
+
+from test.testlib import *
+from git import *
from itertools import chain
from git.objects.utils import get_object_type_by_name
+import tempfile
class TestBase(object):
@@ -53,6 +56,12 @@ class TestBase(object):
data_stream = item.data_stream
data = data_stream.read()
assert data
+
+ tmpfile = os.tmpfile()
+ assert item == item.stream_data(tmpfile)
+ tmpfile.seek(0)
+ assert tmpfile.read() == data
+ # END stream to file directly
# END for each object type to create
# each has a unique sha