summaryrefslogtreecommitdiff
path: root/git/test
diff options
context:
space:
mode:
Diffstat (limited to 'git/test')
-rw-r--r--git/test/fixtures/git_config_global1
-rw-r--r--git/test/lib/helper.py4
-rw-r--r--git/test/performance/test_commit.py4
-rw-r--r--git/test/test_commit.py12
-rw-r--r--git/test/test_config.py4
-rw-r--r--git/test/test_fun.py4
-rw-r--r--git/test/test_index.py6
-rw-r--r--git/test/test_repo.py14
-rw-r--r--git/test/test_tree.py6
9 files changed, 28 insertions, 27 deletions
diff --git a/git/test/fixtures/git_config_global b/git/test/fixtures/git_config_global
index 1a55397f..56fbd3b3 100644
--- a/git/test/fixtures/git_config_global
+++ b/git/test/fixtures/git_config_global
@@ -1,3 +1,4 @@
+# just a comment
[alias]
st = status
ci = commit
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 43079dbe..bc9c351a 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -48,8 +48,8 @@ class StringProcessAdapter(object):
Its tailored to work with the test system only"""
def __init__(self, input_string):
- self.stdout = io.StringIO(input_string)
- self.stderr = io.StringIO()
+ self.stdout = io.BytesIO(input_string)
+ self.stderr = io.BytesIO()
def wait(self):
return 0
diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py
index a55b6d43..9e8c1325 100644
--- a/git/test/performance/test_commit.py
+++ b/git/test/performance/test_commit.py
@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from __future__ import print_function
-from io import StringIO
+from io import BytesIO
from time import time
import sys
@@ -93,7 +93,7 @@ class TestPerformance(TestBigRepoRW):
hc.committer, hc.committed_date, hc.committer_tz_offset,
str(i), parents=hc.parents, encoding=hc.encoding)
- stream = StringIO()
+ stream = BytesIO()
cm._serialize(stream)
slen = stream.tell()
stream.seek(0)
diff --git a/git/test/test_commit.py b/git/test/test_commit.py
index adf1cb10..5f45e59d 100644
--- a/git/test/test_commit.py
+++ b/git/test/test_commit.py
@@ -25,7 +25,7 @@ from git.compat import (
text_type
)
-from io import StringIO
+from io import BytesIO
import time
import sys
import re
@@ -44,7 +44,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
# assert that we deserialize commits correctly, hence we get the same
# sha on serialization
- stream = StringIO()
+ stream = BytesIO()
cm._serialize(stream)
ns += 1
streamlen = stream.tell()
@@ -59,7 +59,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
cm.message, cm.parents, cm.encoding)
assert nc.parents == cm.parents
- stream = StringIO()
+ stream = BytesIO()
nc._serialize(stream)
ns += 1
streamlen = stream.tell()
@@ -276,7 +276,7 @@ class TestCommit(TestBase):
cmt.author.name = "äüß".decode("utf-8")
assert len(cmt.author.name) == 3
- cstream = StringIO()
+ cstream = BytesIO()
cmt._serialize(cstream)
cstream.seek(0)
assert len(cstream.getvalue())
@@ -316,7 +316,7 @@ JzJMZDRLQLFvnzqZuCjE
cmt.gpgsig = "<test\ndummy\nsig>"
assert cmt.gpgsig != fixture_sig
- cstream = StringIO()
+ cstream = BytesIO()
cmt._serialize(cstream)
assert re.search(r"^gpgsig <test\n dummy\n sig>$", cstream.getvalue(), re.MULTILINE)
@@ -326,6 +326,6 @@ JzJMZDRLQLFvnzqZuCjE
assert cmt.gpgsig == "<test\ndummy\nsig>"
cmt.gpgsig = None
- cstream = StringIO()
+ cstream = BytesIO()
cmt._serialize(cstream)
assert not re.search(r"^gpgsig ", cstream.getvalue(), re.MULTILINE)
diff --git a/git/test/test_config.py b/git/test/test_config.py
index ef0707e9..0301c54f 100644
--- a/git/test/test_config.py
+++ b/git/test/test_config.py
@@ -12,7 +12,7 @@ from git import (
GitConfigParser
)
from git.compat import string_types
-import StringIO
+import io
from copy import copy
from ConfigParser import NoSectionError
@@ -21,7 +21,7 @@ class TestBase(TestCase):
def _to_memcache(self, file_path):
fp = open(file_path, "r")
- sio = StringIO.StringIO(fp.read())
+ sio = io.BytesIO(fp.read())
sio.name = file_path
return sio
diff --git a/git/test/test_fun.py b/git/test/test_fun.py
index 4093065d..9d3e749e 100644
--- a/git/test/test_fun.py
+++ b/git/test/test_fun.py
@@ -24,7 +24,7 @@ from stat import (
)
from git.index import IndexFile
-from io import StringIO
+from io import BytesIO
class TestFun(TestBase):
@@ -72,7 +72,7 @@ class TestFun(TestBase):
def mktree(self, odb, entries):
"""create a tree from the given tree entries and safe it to the database"""
- sio = StringIO()
+ sio = BytesIO()
tree_to_stream(entries, sio.write)
sio.seek(0)
istream = odb.store(IStream(str_tree_type, len(sio.getvalue()), sio))
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 70d70a05..38cc3563 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -31,7 +31,7 @@ from stat import (
ST_MODE
)
-from io import StringIO
+from io import BytesIO
from gitdb.base import IStream
from git.objects import Blob
from git.index.typ import (
@@ -698,9 +698,9 @@ class TestIndex(TestBase):
# instead of throwing the Exception we are expecting. This is
# a quick hack to make this test fail when expected.
rw_bare_repo._working_tree_dir = None
- contents = 'This is a StringIO file'
+ contents = b'This is a BytesIO file'
filesize = len(contents)
- fileobj = StringIO(contents)
+ fileobj = BytesIO(contents)
filename = 'my-imaginary-file'
istream = rw_bare_repo.odb.store(
IStream(Blob.type, filesize, fileobj))
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index f33fe467..ae824086 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -36,7 +36,7 @@ import os
import sys
import tempfile
import shutil
-from io import StringIO
+from io import BytesIO
class TestRepo(TestBase):
@@ -362,22 +362,22 @@ class TestRepo(TestBase):
def test_git_cmd(self):
# test CatFileContentStream, just to be very sure we have no fencepost errors
# last \n is the terminating newline that it expects
- l1 = "0123456789\n"
- l2 = "abcdefghijklmnopqrstxy\n"
- l3 = "z\n"
- d = "%s%s%s\n" % (l1, l2, l3)
+ l1 = b"0123456789\n"
+ l2 = b"abcdefghijklmnopqrstxy\n"
+ l3 = b"z\n"
+ d = b"%s%s%s\n" % (l1, l2, l3)
l1p = l1[:5]
# full size
# size is without terminating newline
def mkfull():
- return Git.CatFileContentStream(len(d) - 1, StringIO(d))
+ return Git.CatFileContentStream(len(d) - 1, BytesIO(d))
ts = 5
def mktiny():
- return Git.CatFileContentStream(ts, StringIO(d))
+ return Git.CatFileContentStream(ts, BytesIO(d))
# readlines no limit
s = mkfull()
diff --git a/git/test/test_tree.py b/git/test/test_tree.py
index 3b89abee..72bda485 100644
--- a/git/test/test_tree.py
+++ b/git/test/test_tree.py
@@ -11,7 +11,7 @@ from git import (
Blob
)
-from io import StringIO
+from io import BytesIO
class TestTree(TestBase):
@@ -30,7 +30,7 @@ class TestTree(TestBase):
orig_data = tree.data_stream.read()
orig_cache = tree._cache
- stream = StringIO()
+ stream = BytesIO()
tree._serialize(stream)
assert stream.getvalue() == orig_data
@@ -82,7 +82,7 @@ class TestTree(TestBase):
mod.set_done() # multiple times are okay
# serialize, its different now
- stream = StringIO()
+ stream = BytesIO()
testtree._serialize(stream)
stream.seek(0)
assert stream.getvalue() != orig_data