summaryrefslogtreecommitdiff
path: root/git/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-11-19 12:16:44 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-11-19 12:16:44 +0100
commit257264743154b975bc156f425217593be14727a9 (patch)
tree755ccbe76bc225ef237264e1b45bcb17202087ec /git/test
parent4d9b7b09a7c66e19a608d76282eacc769e349150 (diff)
downloadgitpython-257264743154b975bc156f425217593be14727a9.tar.gz
Applied autopep8
Commandline was autopep8 -j 8 --max-line-length 120 --in-place --recursive --exclude "*gitdb*,*async*" git/
Diffstat (limited to 'git/test')
-rw-r--r--git/test/lib/__init__.py2
-rw-r--r--git/test/lib/helper.py19
-rw-r--r--git/test/performance/lib.py8
-rw-r--r--git/test/performance/test_commit.py12
-rw-r--r--git/test/performance/test_odb.py11
-rw-r--r--git/test/performance/test_streams.py29
-rw-r--r--git/test/performance/test_utils.py23
-rw-r--r--git/test/test_base.py6
-rw-r--r--git/test/test_commit.py16
-rw-r--r--git/test/test_config.py2
-rw-r--r--git/test/test_fun.py22
-rw-r--r--git/test/test_git.py21
-rw-r--r--git/test/test_index.py19
-rw-r--r--git/test/test_reflog.py4
-rw-r--r--git/test/test_refs.py2
-rw-r--r--git/test/test_remote.py29
-rw-r--r--git/test/test_repo.py16
-rw-r--r--git/test/test_submodule.py10
-rw-r--r--git/test/test_tree.py6
-rw-r--r--git/test/test_util.py4
20 files changed, 148 insertions, 113 deletions
diff --git a/git/test/lib/__init__.py b/git/test/lib/__init__.py
index e13e227d..26ea13a3 100644
--- a/git/test/lib/__init__.py
+++ b/git/test/lib/__init__.py
@@ -10,4 +10,4 @@ from asserts import *
from helper import *
__all__ = [name for name, obj in locals().items()
- if not (name.startswith('_') or inspect.ismodule(obj))]
+ if not (name.startswith('_') or inspect.ismodule(obj))]
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 913cf3b6..55e7ba65 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -15,9 +15,9 @@ import cStringIO
GIT_REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
__all__ = (
- 'fixture_path', 'fixture', 'absolute_project_path', 'StringProcessAdapter',
- 'with_rw_repo', 'with_rw_and_rw_remote_repo', 'TestBase', 'TestCase', 'GIT_REPO'
- )
+ 'fixture_path', 'fixture', 'absolute_project_path', 'StringProcessAdapter',
+ 'with_rw_repo', 'with_rw_and_rw_remote_repo', 'TestBase', 'TestCase', 'GIT_REPO'
+)
#{ Routines
@@ -95,7 +95,7 @@ def with_rw_repo(working_tree_ref, bare=False):
prefix = 'non_'
if bare:
prefix = ''
- #END handle prefix
+ # END handle prefix
repo_dir = _mktemp("%sbare_%s" % (prefix, func.__name__))
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=bare, n=True)
@@ -158,7 +158,8 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
repo_dir = _mktemp("remote_clone_non_bare_repo")
rw_remote_repo = self.rorepo.clone(remote_repo_dir, shared=True, bare=True)
- rw_repo = rw_remote_repo.clone(repo_dir, shared=True, bare=False, n=True) # recursive alternates info ?
+ # recursive alternates info ?
+ rw_repo = rw_remote_repo.clone(repo_dir, shared=True, bare=False, n=True)
rw_repo.head.commit = working_tree_ref
rw_repo.head.reference.checkout()
@@ -191,11 +192,13 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
except GitCommandError, e:
print str(e)
if os.name == 'nt':
- raise AssertionError('git-daemon needs to run this test, but windows does not have one. Otherwise, run: git-daemon "%s"' % os.path.dirname(_mktemp()))
+ raise AssertionError(
+ 'git-daemon needs to run this test, but windows does not have one. Otherwise, run: git-daemon "%s"' % os.path.dirname(_mktemp()))
else:
- raise AssertionError('Please start a git-daemon to run this test, execute: git-daemon "%s"' % os.path.dirname(_mktemp()))
+ raise AssertionError(
+ 'Please start a git-daemon to run this test, execute: git-daemon "%s"' % os.path.dirname(_mktemp()))
# END make assertion
- #END catch ls remote error
+ # END catch ls remote error
# adjust working dir
prev_cwd = os.getcwd()
diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py
index 00d41b76..6beff617 100644
--- a/git/test/performance/lib.py
+++ b/git/test/performance/lib.py
@@ -5,13 +5,13 @@ import shutil
import tempfile
from git.db import (
- GitCmdObjectDB,
- GitDB
- )
+ GitCmdObjectDB,
+ GitDB
+)
from git import (
Repo
- )
+)
#{ Invvariants
k_env_git_repo = "GIT_PYTHON_TEST_GIT_REPO_BASE"
diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py
index 009b3d82..c988d160 100644
--- a/git/test/performance/test_commit.py
+++ b/git/test/performance/test_commit.py
@@ -46,7 +46,8 @@ class TestPerformance(TestBigRepoRW):
# END for each object
# END for each commit
elapsed_time = time() - st
- print >> sys.stderr, "Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )" % (nc, no, elapsed_time, no / elapsed_time)
+ print >> sys.stderr, "Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )" % (
+ nc, no, elapsed_time, no / elapsed_time)
def test_commit_traversal(self):
# bound to cat-file parsing performance
@@ -84,9 +85,9 @@ class TestPerformance(TestBigRepoRW):
st = time()
for i in xrange(nc):
cm = Commit(rwrepo, Commit.NULL_BIN_SHA, hc.tree,
- hc.author, hc.authored_date, hc.author_tz_offset,
- hc.committer, hc.committed_date, hc.committer_tz_offset,
- str(i), parents=hc.parents, encoding=hc.encoding)
+ hc.author, hc.authored_date, hc.author_tz_offset,
+ hc.committer, hc.committed_date, hc.committer_tz_offset,
+ str(i), parents=hc.parents, encoding=hc.encoding)
stream = StringIO()
cm._serialize(stream)
@@ -97,4 +98,5 @@ class TestPerformance(TestBigRepoRW):
# END commit creation
elapsed = time() - st
- print >> sys.stderr, "Serialized %i commits to loose objects in %f s ( %f commits / s )" % (nc, elapsed, nc / elapsed)
+ print >> sys.stderr, "Serialized %i commits to loose objects in %f s ( %f commits / s )" % (
+ nc, elapsed, nc / elapsed)
diff --git a/git/test/performance/test_odb.py b/git/test/performance/test_odb.py
index 5ddbbd53..6696e459 100644
--- a/git/test/performance/test_odb.py
+++ b/git/test/performance/test_odb.py
@@ -6,7 +6,7 @@ import stat
from lib import (
TestBigRepoR
- )
+)
class TestObjDBPerformance(TestBigRepoR):
@@ -21,7 +21,8 @@ class TestObjDBPerformance(TestBigRepoR):
nc = len(commits)
elapsed = time() - st
- print >> sys.stderr, "%s: Retrieved %i commits from ObjectStore in %g s ( %f commits / s )" % (type(repo.odb), nc, elapsed, nc / elapsed)
+ print >> sys.stderr, "%s: Retrieved %i commits from ObjectStore in %g s ( %f commits / s )" % (
+ type(repo.odb), nc, elapsed, nc / elapsed)
results[0].append(elapsed)
# GET TREES
@@ -42,7 +43,8 @@ class TestObjDBPerformance(TestBigRepoR):
# END for each commit
elapsed = time() - st
- print >> sys.stderr, "%s: Retrieved %i objects from %i commits in %g s ( %f objects / s )" % (type(repo.odb), nt, len(commits), elapsed, nt / elapsed)
+ print >> sys.stderr, "%s: Retrieved %i objects from %i commits in %g s ( %f objects / s )" % (
+ type(repo.odb), nt, len(commits), elapsed, nt / elapsed)
results[1].append(elapsed)
# GET BLOBS
@@ -60,7 +62,8 @@ class TestObjDBPerformance(TestBigRepoR):
# END for each bloblist
elapsed = time() - st
- print >> sys.stderr, "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )" % (type(repo.odb), nb, data_bytes / 1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed)
+ print >> sys.stderr, "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )" % (
+ type(repo.odb), nb, data_bytes / 1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed)
results[2].append(elapsed)
# END for each repo type
diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py
index e42867a3..7800144d 100644
--- a/git/test/performance/test_streams.py
+++ b/git/test/performance/test_streams.py
@@ -14,7 +14,7 @@ from gitdb.test.lib import make_memory_file
from lib import (
TestBigRepoR
- )
+)
class TestObjDBPerformance(TestBigRepoR):
@@ -45,7 +45,8 @@ class TestObjDBPerformance(TestBigRepoR):
fsize_kib = os.path.getsize(db_file) / 1000
size_kib = size / 1000
- print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to loose odb in %f s ( %f Write KiB / s)" % (size_kib, fsize_kib, desc, elapsed_add, size_kib / elapsed_add)
+ print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to loose odb in %f s ( %f Write KiB / s)" % (
+ size_kib, fsize_kib, desc, elapsed_add, size_kib / elapsed_add)
# reading all at once
st = time()
@@ -55,7 +56,8 @@ class TestObjDBPerformance(TestBigRepoR):
stream.seek(0)
assert shadata == stream.getvalue()
- print >> sys.stderr, "Read %i KiB of %s data at once from loose odb in %f s ( %f Read KiB / s)" % (size_kib, desc, elapsed_readall, size_kib / elapsed_readall)
+ print >> sys.stderr, "Read %i KiB of %s data at once from loose odb in %f s ( %f Read KiB / s)" % (
+ size_kib, desc, elapsed_readall, size_kib / elapsed_readall)
# reading in chunks of 1 MiB
cs = 512 * 1000
@@ -74,7 +76,8 @@ class TestObjDBPerformance(TestBigRepoR):
assert ''.join(chunks) == stream.getvalue()
cs_kib = cs / 1000
- print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from loose odb in %f s ( %f Read KiB / s)" % (size_kib, desc, cs_kib, elapsed_readchunks, size_kib / elapsed_readchunks)
+ print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from loose odb in %f s ( %f Read KiB / s)" % (
+ size_kib, desc, cs_kib, elapsed_readchunks, size_kib / elapsed_readchunks)
# del db file so git has something to do
os.remove(db_file)
@@ -97,19 +100,23 @@ class TestObjDBPerformance(TestBigRepoR):
# as its the same sha, we reuse our path
fsize_kib = os.path.getsize(db_file) / 1000
- print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to using git-hash-object in %f s ( %f Write KiB / s)" % (size_kib, fsize_kib, desc, gelapsed_add, size_kib / gelapsed_add)
+ print >> sys.stderr, "Added %i KiB (filesize = %i KiB) of %s data to using git-hash-object in %f s ( %f Write KiB / s)" % (
+ size_kib, fsize_kib, desc, gelapsed_add, size_kib / gelapsed_add)
# compare ...
- print >> sys.stderr, "Git-Python is %f %% faster than git when adding big %s files" % (100.0 - (elapsed_add / gelapsed_add) * 100, desc)
+ print >> sys.stderr, "Git-Python is %f %% faster than git when adding big %s files" % (
+ 100.0 - (elapsed_add / gelapsed_add) * 100, desc)
# read all
st = time()
s, t, size, data = rwrepo.git.get_object_data(gitsha)
gelapsed_readall = time() - st
- print >> sys.stderr, "Read %i KiB of %s data at once using git-cat-file in %f s ( %f Read KiB / s)" % (size_kib, desc, gelapsed_readall, size_kib / gelapsed_readall)
+ print >> sys.stderr, "Read %i KiB of %s data at once using git-cat-file in %f s ( %f Read KiB / s)" % (
+ size_kib, desc, gelapsed_readall, size_kib / gelapsed_readall)
# compare
- print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %sfiles" % (100.0 - (elapsed_readall / gelapsed_readall) * 100, desc)
+ print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %sfiles" % (
+ 100.0 - (elapsed_readall / gelapsed_readall) * 100, desc)
# read chunks
st = time()
@@ -120,8 +127,10 @@ class TestObjDBPerformance(TestBigRepoR):
break
# END read stream
gelapsed_readchunks = time() - st
- print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from git-cat-file in %f s ( %f Read KiB / s)" % (size_kib, desc, cs_kib, gelapsed_readchunks, size_kib / gelapsed_readchunks)
+ print >> sys.stderr, "Read %i KiB of %s data in %i KiB chunks from git-cat-file in %f s ( %f Read KiB / s)" % (
+ size_kib, desc, cs_kib, gelapsed_readchunks, size_kib / gelapsed_readchunks)
# compare
- print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %s files in chunks" % (100.0 - (elapsed_readchunks / gelapsed_readchunks) * 100, desc)
+ print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %s files in chunks" % (
+ 100.0 - (elapsed_readchunks / gelapsed_readchunks) * 100, desc)
# END for each randomization factor
diff --git a/git/test/performance/test_utils.py b/git/test/performance/test_utils.py
index c8d397fb..7db972f7 100644
--- a/git/test/performance/test_utils.py
+++ b/git/test/performance/test_utils.py
@@ -5,7 +5,7 @@ import stat
from lib import (
TestBigRepoR
- )
+)
class TestUtilPerformance(TestBigRepoR):
@@ -44,7 +44,8 @@ class TestUtilPerformance(TestBigRepoR):
cli.attr
# END for each access
elapsed = time() - st
- print >> sys.stderr, "Accessed %s.attr %i times in %s s ( %f acc / s)" % (cls.__name__, ni, elapsed, ni / elapsed)
+ print >> sys.stderr, "Accessed %s.attr %i times in %s s ( %f acc / s)" % (
+ cls.__name__, ni, elapsed, ni / elapsed)
# END for each class type
# check num of sequence-acceses
@@ -59,7 +60,8 @@ class TestUtilPerformance(TestBigRepoR):
# END for
elapsed = time() - st
na = ni * 3
- print >> sys.stderr, "Accessed %s[x] %i times in %s s ( %f acc / s)" % (cls.__name__, na, elapsed, na / elapsed)
+ print >> sys.stderr, "Accessed %s[x] %i times in %s s ( %f acc / s)" % (
+ cls.__name__, na, elapsed, na / elapsed)
# END for each sequence
def test_instantiation(self):
@@ -84,7 +86,8 @@ class TestUtilPerformance(TestBigRepoR):
# END handle empty cls
# END for each item
elapsed = time() - st
- print >> sys.stderr, "Created %i %ss of size %i in %f s ( %f inst / s)" % (ni, cls.__name__, mni, elapsed, ni / elapsed)
+ print >> sys.stderr, "Created %i %ss of size %i in %f s ( %f inst / s)" % (
+ ni, cls.__name__, mni, elapsed, ni / elapsed)
# END for each type
# END for each item count
@@ -114,21 +117,24 @@ class TestUtilPerformance(TestBigRepoR):
one, two, three, four = sequence
# END for eac iteration
elapsed = time() - st
- print >> sys.stderr, "Unpacked %i %ss of size %i in %f s ( %f acc / s)" % (ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
+ print >> sys.stderr, "Unpacked %i %ss of size %i in %f s ( %f acc / s)" % (
+ ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
st = time()
for i in xrange(ni):
one, two, three, four = sequence[0], sequence[1], sequence[2], sequence[3]
# END for eac iteration
elapsed = time() - st
- print >> sys.stderr, "Unpacked %i %ss of size %i individually in %f s ( %f acc / s)" % (ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
+ print >> sys.stderr, "Unpacked %i %ss of size %i individually in %f s ( %f acc / s)" % (
+ ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
st = time()
for i in xrange(ni):
one, two = sequence[0], sequence[1]
# END for eac iteration
elapsed = time() - st
- print >> sys.stderr, "Unpacked %i %ss of size %i individually (2 of 4) in %f s ( %f acc / s)" % (ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
+ print >> sys.stderr, "Unpacked %i %ss of size %i individually (2 of 4) in %f s ( %f acc / s)" % (
+ ni, type(sequence).__name__, len(sequence), elapsed, ni / elapsed)
# END for each sequence
def test_large_list_vs_iteration(self):
@@ -168,7 +174,8 @@ class TestUtilPerformance(TestBigRepoR):
inst.__class__()
# END for each item
elapsed = time() - st
- print >> sys.stderr, "Created %i items using inst.__class__ in %f s ( %f items / s)" % (ni, elapsed, ni / elapsed)
+ print >> sys.stderr, "Created %i items using inst.__class__ in %f s ( %f items / s)" % (
+ ni, elapsed, ni / elapsed)
st = time()
for i in xrange(ni):
diff --git a/git/test/test_base.py b/git/test/test_base.py
index 81e785ab..d1b57984 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -19,9 +19,9 @@ import tempfile
class TestBase(TestBase):
type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"),
- ("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"),
- ("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None),
- ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None))
+ ("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"),
+ ("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None),
+ ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None))
def test_base_object(self):
# test interface of base object classes
diff --git a/git/test/test_commit.py b/git/test/test_commit.py
index 6cd892f0..22a302c6 100644
--- a/git/test/test_commit.py
+++ b/git/test/test_commit.py
@@ -39,9 +39,9 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
assert istream.hexsha == cm.hexsha
nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree,
- cm.author, cm.authored_date, cm.author_tz_offset,
- cm.committer, cm.committed_date, cm.committer_tz_offset,
- cm.message, cm.parents, cm.encoding)
+ cm.author, cm.authored_date, cm.author_tz_offset,
+ cm.committer, cm.committed_date, cm.committer_tz_offset,
+ cm.message, cm.parents, cm.encoding)
assert nc.parents == cm.parents
stream = StringIO()
@@ -62,7 +62,8 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
elapsed = time.time() - st
if print_performance_info:
- print >> sys.stderr, "Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s" % (ns, nds, elapsed, ns / elapsed, nds / elapsed)
+ print >> sys.stderr, "Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s" % (
+ ns, nds, elapsed, ns / elapsed, nds / elapsed)
# END handle performance info
@@ -191,8 +192,8 @@ class TestCommit(TestBase):
in the commit header. This test ensures that we properly parse it.
"""
revs = self.rorepo.git.rev_list('933d23bf95a5bd1624fbcdf328d904e1fa173474',
- first_parent=True,
- bisect_all=True)
+ first_parent=True,
+ bisect_all=True)
commits = Commit._iter_from_process_or_stream(self.rorepo, StringProcessAdapter(revs))
expected_ids = (
@@ -208,7 +209,8 @@ class TestCommit(TestBase):
assert self.rorepo.tag('refs/tags/0.1.5').commit.count() == 143
def test_list(self):
- assert isinstance(Commit.list_items(self.rorepo, '0.1.5', max_count=5)[hex_to_bin('5117c9c8a4d3af19a9958677e45cda9269de1541')], Commit)
+ assert isinstance(Commit.list_items(self.rorepo, '0.1.5', max_count=5)[
+ hex_to_bin('5117c9c8a4d3af19a9958677e45cda9269de1541')], Commit)
def test_str(self):
commit = Commit(self.rorepo, Commit.NULL_BIN_SHA)
diff --git a/git/test/test_config.py b/git/test/test_config.py
index b6888023..0e5396a3 100644
--- a/git/test/test_config.py
+++ b/git/test/test_config.py
@@ -59,7 +59,7 @@ class TestBase(TestCase):
file_obj.seek(0)
r_config = GitConfigParser(file_obj, read_only=True)
- #print file_obj.getvalue()
+ # print file_obj.getvalue()
assert r_config.has_section(sname)
assert r_config.has_option(sname, oname)
assert r_config.get(sname, oname) == val
diff --git a/git/test/test_fun.py b/git/test/test_fun.py
index 4672901c..5fa0c77b 100644
--- a/git/test/test_fun.py
+++ b/git/test/test_fun.py
@@ -1,24 +1,24 @@
from git.test.lib import *
from git.objects.fun import (
- traverse_tree_recursive,
- traverse_trees_recursive,
- tree_to_stream,
- tree_entries_from_data
- )
+ traverse_tree_recursive,
+ traverse_trees_recursive,
+ tree_to_stream,
+ tree_entries_from_data
+)
from git.index.fun import (
- aggressive_tree_merge
- )
+ aggressive_tree_merge
+)
from gitdb.util import bin_to_hex
from gitdb.base import IStream
from gitdb.typ import str_tree_type
from stat import (
- S_IFDIR,
- S_IFREG,
- S_IFLNK
- )
+ S_IFDIR,
+ S_IFREG,
+ S_IFLNK
+)
from git.index import IndexFile
from cStringIO import StringIO
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 063a4d38..759d4d44 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -7,14 +7,14 @@
import os
import mock
from git.test.lib import (TestBase,
- patch,
- raises,
- assert_equal,
- assert_true,
- assert_match,
- fixture_path)
+ patch,
+ raises,
+ assert_equal,
+ assert_true,
+ assert_match,
+ fixture_path)
from git import (Git,
- GitCommandError)
+ GitCommandError)
class TestGit(TestBase):
@@ -104,17 +104,18 @@ class TestGit(TestBase):
assert isinstance(v, tuple)
for n in v:
assert isinstance(n, int)
- #END verify number types
+ # END verify number types
def test_cmd_override(self):
prev_cmd = self.git.GIT_PYTHON_GIT_EXECUTABLE
try:
# set it to something that doens't exist, assure it raises
- type(self.git).GIT_PYTHON_GIT_EXECUTABLE = os.path.join("some", "path", "which", "doesn't", "exist", "gitbinary")
+ type(self.git).GIT_PYTHON_GIT_EXECUTABLE = os.path.join(
+ "some", "path", "which", "doesn't", "exist", "gitbinary")
self.failUnlessRaises(OSError, self.git.version)
finally:
type(self.git).GIT_PYTHON_GIT_EXECUTABLE = prev_cmd
- #END undo adjustment
+ # END undo adjustment
def test_options_are_passed_to_git(self):
# This work because any command after git --version is ignored
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 3440c5be..c1153e5e 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -19,6 +19,7 @@ from gitdb.base import IStream
from git.objects import Blob
from git.index.typ import BaseIndexEntry
+
class TestIndex(TestBase):
def __init__(self, *args):
@@ -68,7 +69,7 @@ class TestIndex(TestBase):
last_val = None
entry = index.entries.itervalues().next()
for attr in ("path", "ctime", "mtime", "dev", "inode", "mode", "uid",
- "gid", "size", "binsha", "hexsha", "stage"):
+ "gid", "size", "binsha", "hexsha", "stage"):
val = getattr(entry, attr)
# END for each method
@@ -104,7 +105,8 @@ class TestIndex(TestBase):
if len(blist) != len(index.entries):
iset = set(k[0] for k in index.entries.keys())
bset = set(b.path for b in blist)
- raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" % (bset - iset, iset - bset))
+ raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" %
+ (bset - iset, iset - bset))
# END assertion message
@with_rw_repo('0.1.6')
@@ -457,7 +459,8 @@ class TestIndex(TestBase):
assert len(entries) == 14
# same file
- entries = index.reset(new_commit).add([os.path.abspath(os.path.join('lib', 'git', 'head.py'))] * 2, fprogress=self._fprogress_add)
+ entries = index.reset(new_commit).add(
+ [os.path.abspath(os.path.join('lib', 'git', 'head.py'))] * 2, fprogress=self._fprogress_add)
self._assert_entries(entries)
assert entries[0].mode & 0644 == 0644
# would fail, test is too primitive to handle this case
@@ -478,12 +481,14 @@ class TestIndex(TestBase):
# mode 0 not allowed
null_hex_sha = Diff.NULL_HEX_SHA
null_bin_sha = "\0" * 20
- self.failUnlessRaises(ValueError, index.reset(new_commit).add, [BaseIndexEntry((0, null_bin_sha, 0, "doesntmatter"))])
+ self.failUnlessRaises(ValueError, index.reset(
+ new_commit).add, [BaseIndexEntry((0, null_bin_sha, 0, "doesntmatter"))])
# add new file
new_file_relapath = "my_new_file"
new_file_path = self._make_file(new_file_relapath, "hello world", rw_repo)
- entries = index.reset(new_commit).add([BaseIndexEntry((010644, null_bin_sha, 0, new_file_relapath))], fprogress=self._fprogress_add)
+ entries = index.reset(new_commit).add(
+ [BaseIndexEntry((010644, null_bin_sha, 0, new_file_relapath))], fprogress=self._fprogress_add)
self._assert_entries(entries)
self._assert_fprogress(entries)
assert len(entries) == 1 and entries[0].hexsha != null_hex_sha
@@ -678,7 +683,7 @@ class TestIndex(TestBase):
fileobj = StringIO(contents)
filename = 'my-imaginary-file'
istream = rw_bare_repo.odb.store(
- IStream(Blob.type, filesize, fileobj))
+ IStream(Blob.type, filesize, fileobj))
entry = BaseIndexEntry((100644, istream.binsha, 0, filename))
try:
rw_bare_repo.index.add([entry])
@@ -693,5 +698,3 @@ class TestIndex(TestBase):
except Exception, e:
asserted = "does not have a working tree" in e.message
assert asserted, "Adding using a filename is not correctly asserted."
-
-
diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py
index fec50095..c281aa44 100644
--- a/git/test/test_reflog.py
+++ b/git/test/test_reflog.py
@@ -53,7 +53,7 @@ class TestRefLog(TestBase):
pp = 'reflog_invalid_'
for suffix in ('oldsha', 'newsha', 'email', 'date', 'sep'):
self.failUnlessRaises(ValueError, RefLog.from_file, fixture_path(pp + suffix))
- #END for each invalid file
+ # END for each invalid file
# cannot write an uninitialized reflog
self.failUnlessRaises(ValueError, RefLog().write)
@@ -93,7 +93,7 @@ class TestRefLog(TestBase):
# ... and negative
for idx in (-1, -24):
RefLog.entry_at(rlp, idx)
- #END for each index to read
+ # END for each index to read
# END for each reflog
# finally remove our temporary data
diff --git a/git/test/test_refs.py b/git/test/test_refs.py
index ee9d8074..c4f7077b 100644
--- a/git/test/test_refs.py
+++ b/git/test/test_refs.py
@@ -297,7 +297,7 @@ class TestRefs(TestBase):
if remote_head_name in refs:
RemoteReference.delete(rw_repo, refs[remote_head_name])
del(refs[remote_head_name])
- #END handle HEAD deletion
+ # END handle HEAD deletion
RemoteReference.delete(rw_repo, *refs)
remote_refs_so_far += len(refs)
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index a5a73ce1..254ad923 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -118,10 +118,11 @@ class TestRemote(TestBase):
def _do_test_fetch_info(self, repo):
self.failUnlessRaises(ValueError, FetchInfo._from_line, repo, "nonsense", '')
- self.failUnlessRaises(ValueError, FetchInfo._from_line, repo, "? [up to date] 0.1.7RC -> origin/0.1.7RC", '')
+ self.failUnlessRaises(
+ ValueError, FetchInfo._from_line, repo, "? [up to date] 0.1.7RC -> origin/0.1.7RC", '')
def _commit_random_file(self, repo):
- #Create a file with a random name and random data and commit it to repo.
+ # Create a file with a random name and random data and commit it to repo.
# Return the commited absolute file path
index = repo.index
new_file = self._make_file(os.path.basename(tempfile.mktemp()), str(random.random()), repo)
@@ -449,8 +450,8 @@ class TestRemote(TestBase):
fetch_info_line_fmt = "c437ee5deb8d00cf02f03720693e4c802e99f390 not-for-merge %s '0.3' of git://github.com/gitpython-developers/GitPython"
remote_info_line_fmt = "* [new branch] nomatter -> %s"
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "local/master",
- fetch_info_line_fmt % 'remote-tracking branch')
+ remote_info_line_fmt % "local/master",
+ fetch_info_line_fmt % 'remote-tracking branch')
assert fi.ref.is_valid()
assert fi.ref.commit
@@ -458,16 +459,16 @@ class TestRemote(TestBase):
# or a special path just in refs/something for instance
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "subdir/tagname",
- fetch_info_line_fmt % 'tag')
+ remote_info_line_fmt % "subdir/tagname",
+ fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
assert fi.ref.path.startswith('refs/tags')
# it could be in a remote direcftory though
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "remotename/tags/tagname",
- fetch_info_line_fmt % 'tag')
+ remote_info_line_fmt % "remotename/tags/tagname",
+ fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
assert fi.ref.path.startswith('refs/remotes/')
@@ -475,24 +476,24 @@ class TestRemote(TestBase):
# it can also be anywhere !
tag_path = "refs/something/remotename/tags/tagname"
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % tag_path,
- fetch_info_line_fmt % 'tag')
+ remote_info_line_fmt % tag_path,
+ fetch_info_line_fmt % 'tag')
assert isinstance(fi.ref, TagReference)
assert fi.ref.path == tag_path
# branches default to refs/remotes
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "remotename/branch",
- fetch_info_line_fmt % 'branch')
+ remote_info_line_fmt % "remotename/branch",
+ fetch_info_line_fmt % 'branch')
assert isinstance(fi.ref, RemoteReference)
assert fi.ref.remote_name == 'remotename'
# but you can force it anywhere, in which case we only have a references
fi = FetchInfo._from_line(self.rorepo,
- remote_info_line_fmt % "refs/something/branch",
- fetch_info_line_fmt % 'branch')
+ remote_info_line_fmt % "refs/something/branch",
+ fetch_info_line_fmt % 'branch')
assert type(fi.ref) is Reference
assert fi.ref.path == "refs/something/branch"
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index 83bcdcbe..2cef4081 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -17,13 +17,15 @@ from git.util import join_path_native
from git.exc import BadObject
from gitdb.util import hex_to_bin, bin_to_hex
-import os, sys
+import os
+import sys
import tempfile
import shutil
from cStringIO import StringIO
class TestRepo(TestBase):
+
@raises(InvalidGitRepositoryError)
def test_new_should_raise_on_invalid_repo_location(self):
Repo(tempfile.gettempdir())
@@ -276,16 +278,16 @@ class TestRepo(TestBase):
def test_blame_real(self):
c = 0
for item in self.rorepo.head.commit.tree.traverse(
- predicate=lambda i, d: i.type == 'blob' and i.path.endswith('.py')):
+ predicate=lambda i, d: i.type == 'blob' and i.path.endswith('.py')):
c += 1
b = self.rorepo.blame(self.rorepo.head, item.path)
- #END for each item to traverse
+ # END for each item to traverse
assert c
def test_untracked_files(self):
base = self.rorepo.working_tree_dir
files = (join_path_native(base, "__test_myfile"),
- join_path_native(base, "__test_other_file"))
+ join_path_native(base, "__test_other_file"))
num_recently_untracked = 0
try:
for fpath in files:
@@ -577,7 +579,7 @@ class TestRepo(TestBase):
# all additional specs work as well
assert rev_parse(refspec + "^{tree}") == head.commit.tree
assert rev_parse(refspec + ":CHANGES").type == 'blob'
- #END operate on non-detached head
+ # END operate on non-detached head
# the last position
assert rev_parse('@{1}') != head.commit
@@ -622,11 +624,11 @@ class TestRepo(TestBase):
os.rename(rwrepo.git_dir, real_path_abs)
git_file_path = join_path_native(rwrepo.working_tree_dir, '.git')
open(git_file_path, 'wb').write(fixture('git_file'))
-
+
# Create a repo and make sure it's pointing to the relocated .git directory.
git_file_repo = Repo(rwrepo.working_tree_dir)
assert os.path.abspath(git_file_repo.git_dir) == real_path_abs
-
+
# Test using an absolute gitdir path in the .git file.
open(git_file_path, 'wb').write('gitdir: %s\n' % real_path_abs)
git_file_repo = Repo(rwrepo.working_tree_dir)
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index 0ecb5c1f..69640e3c 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -20,8 +20,9 @@ if sys.platform == 'win32':
smmap.util.MapRegion._test_read_into_memory = True
except ImportError:
sys.stderr.write("The submodule tests will fail as some files cannot be removed due to open file handles.\n")
- sys.stderr.write("The latest version of gitdb uses a memory map manager which can be configured to work around this problem")
-#END handle windows platform
+ sys.stderr.write(
+ "The latest version of gitdb uses a memory map manager which can be configured to work around this problem")
+# END handle windows platform
class TestRootProgress(RootUpdateProgress):
@@ -425,7 +426,8 @@ class TestSubmodule(TestBase):
assert not sm.module_exists() # was never updated after rwrepo's clone
# assure we clone from a local source
- sm.config_writer().set_value('url', to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, sm.path)))
+ sm.config_writer().set_value(
+ 'url', to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, sm.path)))
# dry-run does nothing
sm.update(recursive=False, dry_run=True, progress=prog)
@@ -535,7 +537,7 @@ class TestSubmodule(TestBase):
assert nsmmh.ref.tracking_branch() is None # never set it up until now
assert not nsmmh.is_detached
- #dry run does nothing
+ # dry run does nothing
rm.update(recursive=False, dry_run=True, progress=prog)
assert nsmmh.ref.tracking_branch() is None
diff --git a/git/test/test_tree.py b/git/test/test_tree.py
index 0f1fb7c3..2c740f1a 100644
--- a/git/test/test_tree.py
+++ b/git/test/test_tree.py
@@ -8,9 +8,9 @@ import os
from git.test.lib import *
from git import *
from git.objects.fun import (
- traverse_tree_recursive,
- traverse_trees_recursive
- )
+ traverse_tree_recursive,
+ traverse_trees_recursive
+)
from cStringIO import StringIO
diff --git a/git/test/test_util.py b/git/test/test_util.py
index 63842d19..d8682030 100644
--- a/git/test/test_util.py
+++ b/git/test/test_util.py
@@ -116,7 +116,7 @@ class TestUtils(TestBase):
for cr in (None, self.rorepo.config_reader()):
assert isinstance(Actor.committer(cr), Actor)
assert isinstance(Actor.author(cr), Actor)
- #END assure config reader is handled
+ # END assure config reader is handled
def test_iterable_list(self):
for args in (('name',), ('name', 'prefix_')):
@@ -163,4 +163,4 @@ class TestUtils(TestBase):
self.failUnlessRaises(IndexError, l.__delitem__, 0)
self.failUnlessRaises(IndexError, l.__delitem__, 'something')
- #END for each possible mode
+ # END for each possible mode