summaryrefslogtreecommitdiff
path: root/git/test/test_base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-06 16:11:34 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-06 16:11:34 +0100
commit56e942318f3c493c8dcd4759f806034331ebeda5 (patch)
tree82cdca65cd197f36ea3680171186e0ddcf234266 /git/test/test_base.py
parentd46e3fe9cb0dea2617cd9231d29bf6919b0f1e91 (diff)
parent68f8a43d1b643318732f30ee1cd75e1d315a4537 (diff)
downloadgitpython-56e942318f3c493c8dcd4759f806034331ebeda5.tar.gz
Merge branch 'py3' into 0.3
Conflicts: git/refs/log.py
Diffstat (limited to 'git/test/test_base.py')
-rw-r--r--git/test/test_base.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/git/test/test_base.py b/git/test/test_base.py
index a14d4680..301384ef 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -1,12 +1,13 @@
+#-*-coding:utf-8-*-
# test_base.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-
-import git.objects.base as base
import os
+import tempfile
+import git.objects.base as base
from git.test.lib import (
TestBase,
assert_raises,
@@ -68,10 +69,13 @@ class TestBase(TestBase):
data = data_stream.read()
assert data
- tmpfile = os.tmpfile()
+ tmpfilename = tempfile.mktemp(suffix='test-stream')
+ tmpfile = open(tmpfilename, 'wb+')
assert item == item.stream_data(tmpfile)
tmpfile.seek(0)
assert tmpfile.read() == data
+ tmpfile.close()
+ os.remove(tmpfilename)
# END stream to file directly
# END for each object type to create
@@ -85,7 +89,7 @@ class TestBase(TestBase):
assert base.Object in get_object_type_by_name(tname).mro()
# END for each known type
- assert_raises(ValueError, get_object_type_by_name, "doesntexist")
+ assert_raises(ValueError, get_object_type_by_name, b"doesntexist")
def test_object_resolution(self):
# objects must be resolved to shas so they compare equal
@@ -106,3 +110,13 @@ class TestBase(TestBase):
assert not rw_repo.config_reader("repository").getboolean("core", "bare")
assert rw_remote_repo.config_reader("repository").getboolean("core", "bare")
assert os.path.isdir(os.path.join(rw_repo.working_tree_dir, 'lib'))
+
+ @with_rw_repo('0.1.6')
+ def test_add_unicode(self, rw_repo):
+ filename = u"שלום.txt"
+
+ file_path = os.path.join(rw_repo.working_dir, filename)
+ open(file_path, "wb").write(b'something')
+
+ rw_repo.git.add(rw_repo.working_dir)
+ rw_repo.index.commit('message')