summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/git/test_git.py7
-rw-r--r--test/testlib/helper.py13
2 files changed, 15 insertions, 5 deletions
diff --git a/test/git/test_git.py b/test/git/test_git.py
index cae75672..8ea9b8ef 100644
--- a/test/git/test_git.py
+++ b/test/git/test_git.py
@@ -25,3 +25,10 @@ class TestGit(object):
def test_it_executes_git_to_shell_and_returns_result(self):
assert_match('^git version [\d\.]*$', self.git.execute(["git","version"]))
+
+ def test_it_accepts_stdin(self):
+ filename = fixture_path("cat_file_blob")
+ fh = open(filename, 'r')
+ assert_equal( "70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
+ self.git.hash_object(istream=fh, stdin=True) )
+ fh.close()
diff --git a/test/testlib/helper.py b/test/testlib/helper.py
index 19cff8f5..0e3f6bf5 100644
--- a/test/testlib/helper.py
+++ b/test/testlib/helper.py
@@ -1,10 +1,13 @@
import os
-GIT_REPO = os.path.join(os.path.dirname(__file__), "..", "..")
+GIT_REPO = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
-def fixture(name):
- file = open(os.path.join(os.path.dirname(__file__), "..", "fixtures", name))
- return file.read()
+def fixture_path(name):
+ test_dir = os.path.dirname( os.path.dirname(__file__) )
+ return os.path.join(test_dir, "fixtures", name)
+
+def fixture(name):
+ return open(fixture_path(name)).read()
def absolute_project_path():
- return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) \ No newline at end of file
+ return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))