diff options
Diffstat (limited to 'git/test')
-rw-r--r-- | git/test/lib/asserts.py | 4 | ||||
-rw-r--r-- | git/test/lib/helper.py | 34 | ||||
-rw-r--r-- | git/test/performance/lib.py | 6 | ||||
-rw-r--r-- | git/test/performance/test_commit.py | 12 | ||||
-rw-r--r-- | git/test/performance/test_streams.py | 10 | ||||
-rw-r--r-- | git/test/performance/test_utils.py | 4 | ||||
-rw-r--r-- | git/test/test_base.py | 8 | ||||
-rw-r--r-- | git/test/test_commit.py | 20 | ||||
-rw-r--r-- | git/test/test_config.py | 2 | ||||
-rw-r--r-- | git/test/test_diff.py | 12 | ||||
-rw-r--r-- | git/test/test_fun.py | 6 | ||||
-rw-r--r-- | git/test/test_git.py | 2 | ||||
-rw-r--r-- | git/test/test_index.py | 52 | ||||
-rw-r--r-- | git/test/test_reflog.py | 4 | ||||
-rw-r--r-- | git/test/test_refs.py | 24 | ||||
-rw-r--r-- | git/test/test_remote.py | 54 | ||||
-rw-r--r-- | git/test/test_repo.py | 30 | ||||
-rw-r--r-- | git/test/test_submodule.py | 24 | ||||
-rw-r--r-- | git/test/test_tree.py | 2 |
19 files changed, 155 insertions, 155 deletions
diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py index ec3eef96..351901dc 100644 --- a/git/test/lib/asserts.py +++ b/git/test/lib/asserts.py @@ -10,7 +10,7 @@ from nose import tools from nose.tools import * import stat -__all__ = ['assert_instance_of', 'assert_not_instance_of', +__all__ = ['assert_instance_of', 'assert_not_instance_of', 'assert_none', 'assert_not_none', 'assert_match', 'assert_not_match', 'assert_mode_644', 'assert_mode_755'] + tools.__all__ @@ -48,7 +48,7 @@ def assert_not_match(pattern, string, msg=None): def assert_mode_644(mode): """Verify given mode is 644""" - assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP) + assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP) assert (mode & stat.S_IWUSR) and (mode & stat.S_IRUSR) and not (mode & stat.S_IXUSR) diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 812aecdc..913cf3b6 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -36,7 +36,7 @@ def absolute_project_path(): #} END routines -#{ Adapters +#{ Adapters class StringProcessAdapter(object): @@ -55,7 +55,7 @@ class StringProcessAdapter(object): #} END adapters -#{ Decorators +#{ Decorators def _mktemp(*args): @@ -68,7 +68,7 @@ def _mktemp(*args): def _rmtree_onerror(osremove, fullpath, exec_info): """ - Handle the case on windows that read-only files cannot be deleted by + Handle the case on windows that read-only files cannot be deleted by os.remove by setting it to mode 777, then retry deletion. """ if os.name != 'nt' or osremove is not os.remove: @@ -80,12 +80,12 @@ def _rmtree_onerror(osremove, fullpath, exec_info): def with_rw_repo(working_tree_ref, bare=False): """ - Same as with_bare_repo, but clones the rorepo as non-bare repository, checking + Same as with_bare_repo, but clones the rorepo as non-bare repository, checking out the working tree at the given working_tree_ref. This repository type is more costly due to the working copy checkout. - To make working with relative paths easier, the cwd will be set to the working + To make working with relative paths easier, the cwd will be set to the working dir of the repository. """ assert isinstance(working_tree_ref, basestring), "Decorator requires ref name for working tree checkout" @@ -130,14 +130,14 @@ def with_rw_repo(working_tree_ref, bare=False): def with_rw_and_rw_remote_repo(working_tree_ref): """ Same as with_rw_repo, but also provides a writable remote repository from which the - rw_repo has been forked as well as a handle for a git-daemon that may be started to + rw_repo has been forked as well as a handle for a git-daemon that may be started to run the remote_repo. - The remote repository was cloned as bare repository from the rorepo, wheras + The remote repository was cloned as bare repository from the rorepo, wheras the rw repo has a working tree and was cloned from the remote repository. - remote_repo has two remotes: origin and daemon_origin. One uses a local url, - the other uses a server url. The daemon setup must be done on system level - and should be an inetd service that serves tempdir.gettempdir() and all + remote_repo has two remotes: origin and daemon_origin. One uses a local url, + the other uses a server url. The daemon setup must be done on system level + and should be an inetd service that serves tempdir.gettempdir() and all directories in it. The following scetch demonstrates this:: @@ -176,7 +176,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref): # release lock del(crw) - # initialize the remote - first do it as local remote and pull, then + # initialize the remote - first do it as local remote and pull, then # we change the url to point to the daemon. The daemon should be started # by the user, not by us d_remote = Remote.create(rw_repo, "daemon_origin", remote_repo_dir) @@ -191,7 +191,7 @@ 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())) # END make assertion @@ -229,20 +229,20 @@ class TestBase(TestCase): self.fail("todo") self.failUnlessRaises(...) - - Class level repository which is considered read-only as it is shared among + - Class level repository which is considered read-only as it is shared among all test cases in your type. - Access it using:: + Access it using:: self.rorepo # 'ro' stands for read-only - The rorepo is in fact your current project's git repo. If you refer to specific - shas for your objects, be sure you choose some that are part of the immutable portion + The rorepo is in fact your current project's git repo. If you refer to specific + shas for your objects, be sure you choose some that are part of the immutable portion of the project history ( to assure tests don't fail for others ). """ @classmethod def setUpClass(cls): """ - Dynamically add a read-only repository to our actual type. This way + Dynamically add a read-only repository to our actual type. This way each test type has its own repository """ cls.rorepo = Repo(GIT_REPO) diff --git a/git/test/performance/lib.py b/git/test/performance/lib.py index 28500da4..00d41b76 100644 --- a/git/test/performance/lib.py +++ b/git/test/performance/lib.py @@ -30,11 +30,11 @@ def resolve_or_fail(env_var): #} END utilities -#{ Base Classes +#{ Base Classes class TestBigRepoR(TestBase): - """TestCase providing access to readonly 'big' repositories using the following + """TestCase providing access to readonly 'big' repositories using the following member variables: * gitrorepo @@ -49,7 +49,7 @@ class TestBigRepoR(TestBase): #{ Invariants head_sha_2k = '235d521da60e4699e5bd59ac658b5b48bd76ddca' head_sha_50 = '32347c375250fd470973a5d76185cac718955fd5' - #} END invariants + #} END invariants @classmethod def setUp(cls): diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py index adee2567..009b3d82 100644 --- a/git/test/performance/test_commit.py +++ b/git/test/performance/test_commit.py @@ -32,8 +32,8 @@ class TestPerformance(TestBigRepoRW): no = 0 nc = 0 - # find the first commit containing the given path - always do a full - # iteration ( restricted to the path in question ), but in fact it should + # find the first commit containing the given path - always do a full + # iteration ( restricted to the path in question ), but in fact it should # return quite a lot of commits, we just take one and hence abort the operation st = time() @@ -46,7 +46,7 @@ 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 @@ -83,9 +83,9 @@ class TestPerformance(TestBigRepoRW): nc = 5000 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, + 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) stream = StringIO() diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py index 32ae98bf..e42867a3 100644 --- a/git/test/performance/test_streams.py +++ b/git/test/performance/test_streams.py @@ -36,7 +36,7 @@ class TestObjDBPerformance(TestBigRepoR): elapsed = time() - st print >> sys.stderr, "Done (in %f s)" % elapsed - # writing - due to the compression it will seem faster than it is + # writing - due to the compression it will seem faster than it is st = time() binsha = ldb.store(IStream('blob', size, stream)).binsha elapsed_add = time() - st @@ -79,7 +79,7 @@ class TestObjDBPerformance(TestBigRepoR): # del db file so git has something to do os.remove(db_file) - # VS. CGIT + # VS. CGIT ########## # CGIT ! Can using the cgit programs be faster ? proc = rwrepo.git.hash_object('-w', '--stdin', as_process=True, istream=subprocess.PIPE) @@ -99,7 +99,7 @@ class TestObjDBPerformance(TestBigRepoR): 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) - # compare ... + # compare ... 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 @@ -108,7 +108,7 @@ class TestObjDBPerformance(TestBigRepoR): 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) - # compare + # compare print >> sys.stderr, "Git-Python is %f %% faster than git when reading big %sfiles" % (100.0 - (elapsed_readall / gelapsed_readall) * 100, desc) # read chunks @@ -122,6 +122,6 @@ class TestObjDBPerformance(TestBigRepoR): 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) - # compare + # 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) # END for each randomization factor diff --git a/git/test/performance/test_utils.py b/git/test/performance/test_utils.py index 19c37a5f..c8d397fb 100644 --- a/git/test/performance/test_utils.py +++ b/git/test/performance/test_utils.py @@ -60,7 +60,7 @@ class TestUtilPerformance(TestBigRepoR): 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) - # END for each sequence + # END for each sequence def test_instantiation(self): ni = 100000 @@ -138,7 +138,7 @@ class TestUtilPerformance(TestBigRepoR): yield i # END slow iter - be closer to the real world - # alloc doesn't play a role here it seems + # alloc doesn't play a role here it seems for ni in (500, 1000, 10000, 20000, 40000): st = time() for i in list(xrange(ni)): diff --git a/git/test/test_base.py b/git/test/test_base.py index 211c7479..81e785ab 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -18,12 +18,12 @@ import tempfile class TestBase(TestBase): - type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"), + type_tuples = (("blob", "8741fc1d09d61f02ffd8cded15ff603eff1ec070", "blob.py"), ("tree", "3a6a5e3eeed3723c09f1ef0399f81ed6b8d82e79", "directory"), ("commit", "4251bd59fb8e11e40c40548cba38180a9536118c", None), - ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None)) + ("tag", "e56a60e8e9cd333cfba0140a77cd12b0d9398f10", None)) - def test_base_object(self): + def test_base_object(self): # test interface of base object classes types = (Blob, Tree, Commit, TagObject) assert len(types) == len(self.type_tuples) @@ -76,7 +76,7 @@ class TestBase(TestBase): def test_get_object_type_by_name(self): for tname in base.Object.TYPES: assert base.Object in get_object_type_by_name(tname).mro() - # END for each known type + # END for each known type assert_raises(ValueError, get_object_type_by_name, "doesntexist") diff --git a/git/test/test_commit.py b/git/test/test_commit.py index e211f75b..6cd892f0 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -17,7 +17,7 @@ import re def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False): - """traverse all commits in the history of commit identified by commit_id and check + """traverse all commits in the history of commit identified by commit_id and check if the serialization works. :param print_performance_info: if True, we will show how fast we are""" ns = 0 # num serializations @@ -27,7 +27,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False) for cm in rwrepo.commit(commit_id).traverse(): nds += 1 - # assert that we deserialize commits correctly, hence we get the same + # assert that we deserialize commits correctly, hence we get the same # sha on serialization stream = StringIO() cm._serialize(stream) @@ -39,8 +39,8 @@ 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.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 @@ -90,11 +90,11 @@ class TestCommit(TestBase): assert isinstance(d, dict) for key in ("insertions", "deletions", "lines"): assert key in d - # END assertion helper - assert stats.files + # END assertion helper + assert stats.files assert stats.total - check_entries(stats.total) + check_entries(stats.total) assert "files" in stats.total for filepath, d in stats.files.items(): @@ -147,7 +147,7 @@ class TestCommit(TestBase): # ignore self assert start.traverse(ignore_self=False).next() == start - # depth + # depth assert len(list(start.traverse(ignore_self=False, depth=0))) == 1 # prune @@ -159,7 +159,7 @@ class TestCommit(TestBase): # traversal should stop when the beginning is reached self.failUnlessRaises(StopIteration, first.traverse().next) - # parents of the first commit should be empty ( as the only parent has a null + # parents of the first commit should be empty ( as the only parent has a null # sha ) assert len(first.parents) == 0 @@ -233,7 +233,7 @@ class TestCommit(TestBase): first_parent = piter.next() assert first_parent != c assert first_parent == c.parents[0] - # END for each + # END for each def test_base(self): name_rev = self.rorepo.head.commit.name_rev diff --git a/git/test/test_config.py b/git/test/test_config.py index de4727e0..b6888023 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -91,7 +91,7 @@ class TestBase(TestCase): self.failUnlessRaises(IOError, r_config.remove_option, section, option) # END for each option self.failUnlessRaises(IOError, r_config.remove_section, section) - # END for each section + # END for each section assert num_sections and num_options assert r_config._is_initialized == True diff --git a/git/test/test_diff.py b/git/test/test_diff.py index aacd9368..151a3d14 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -48,8 +48,8 @@ class TestDiff(TestBase): def test_diff_patch_format(self): # test all of the 'old' format diffs for completness - it should at least # be able to deal with it - fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", - "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", + fixtures = ("diff_2", "diff_2f", "diff_f", "diff_i", "diff_mode_only", + "diff_new_mode", "diff_numstat", "diff_p", "diff_rename", "diff_tree_numstat_root") for fixture_name in fixtures: @@ -77,7 +77,7 @@ class TestDiff(TestBase): for ct in DiffIndex.change_type: key = 'ct_%s' % ct assertion_map.setdefault(key, 0) - assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct))) + assertion_map[key] = assertion_map[key] + len(list(diff_index.iter_change_type(ct))) # END for each changetype # check entries @@ -87,18 +87,18 @@ class TestDiff(TestBase): assert len(diff_set) == 1 assert diff_index[0] == diff_index[0] assert not (diff_index[0] != diff_index[0]) - # END diff index checking + # END diff index checking # END for each patch option # END for each path option # END for each other side # END for each commit - # assert we could always find at least one instance of the members we + # assert we could always find at least one instance of the members we # can iterate in the diff index - if not this indicates its not working correctly # or our test does not span the whole range of possibilities for key, value in assertion_map.items(): assert value, "Did not find diff for %s" % key - # END for each iteration type + # END for each iteration type # test path not existing in the index - should be ignored c = self.rorepo.head.commit diff --git a/git/test/test_fun.py b/git/test/test_fun.py index 9d6f3ea4..4672901c 100644 --- a/git/test/test_fun.py +++ b/git/test/test_fun.py @@ -1,7 +1,7 @@ from git.test.lib import * from git.objects.fun import ( traverse_tree_recursive, - traverse_trees_recursive, + traverse_trees_recursive, tree_to_stream, tree_entries_from_data ) @@ -15,7 +15,7 @@ from gitdb.base import IStream from gitdb.typ import str_tree_type from stat import ( - S_IFDIR, + S_IFDIR, S_IFREG, S_IFLNK ) @@ -37,7 +37,7 @@ class TestFun(TestBase): def test_aggressive_tree_merge(self): # head tree with additions, removals and modification compared to its predecessor odb = self.rorepo.odb - HC = self.rorepo.commit("6c1faef799095f3990e9970bc2cb10aa0221cf9c") + HC = self.rorepo.commit("6c1faef799095f3990e9970bc2cb10aa0221cf9c") H = HC.tree B = HC.parents[0].tree diff --git a/git/test/test_git.py b/git/test/test_git.py index e8a4c6b3..49c256ca 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -6,7 +6,7 @@ import os from git.test.lib import (TestBase, - patch, + patch, raises, assert_equal, assert_true, diff --git a/git/test/test_index.py b/git/test/test_index.py index f5c92099..f1f718cd 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -38,7 +38,7 @@ class TestIndex(TestBase): self._fprogress_map[path] = curval + 1 def _fprogress_add(self, path, done, item): - """Called as progress func - we keep track of the proper + """Called as progress func - we keep track of the proper call order""" assert item is not None self._fprogress(path, done, item) @@ -109,7 +109,7 @@ class TestIndex(TestBase): cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573" other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9" - # simple index from tree + # simple index from tree base_index = IndexFile.from_tree(rw_repo, common_ancestor_sha) assert base_index.entries self._cmp_tree_index(common_ancestor_sha, base_index) @@ -133,7 +133,7 @@ class TestIndex(TestBase): # test BlobFilter prefix = 'lib/git' for stage, blob in base_index.iter_blobs(BlobFilter([prefix])): - assert blob.path.startswith(prefix) + assert blob.path.startswith(prefix) # writing a tree should fail with an unmerged index self.failUnlessRaises(UnmergedEntriesError, three_way_index.write_tree) @@ -155,7 +155,7 @@ class TestIndex(TestBase): @with_rw_repo('0.1.6') def test_index_merge_tree(self, rw_repo): - # A bit out of place, but we need a different repo for this: + # A bit out of place, but we need a different repo for this: assert self.rorepo != rw_repo and not (self.rorepo == rw_repo) assert len(set((self.rorepo, self.rorepo, rw_repo, rw_repo))) == 2 @@ -174,18 +174,18 @@ class TestIndex(TestBase): # FAKE MERGE ############# - # Add a change with a NULL sha that should conflict with next_commit. We - # pretend there was a change, but we do not even bother adding a proper + # Add a change with a NULL sha that should conflict with next_commit. We + # pretend there was a change, but we do not even bother adding a proper # sha for it ( which makes things faster of course ) manifest_fake_entry = BaseIndexEntry((manifest_entry[0], "\0" * 20, 0, manifest_entry[3])) # try write flag self._assert_entries(rw_repo.index.add([manifest_fake_entry], write=False)) - # add actually resolves the null-hex-sha for us as a feature, but we can + # add actually resolves the null-hex-sha for us as a feature, but we can # edit the index manually assert rw_repo.index.entries[manifest_key].binsha != Object.NULL_BIN_SHA - # must operate on the same index for this ! Its a bit problematic as + # must operate on the same index for this ! Its a bit problematic as # it might confuse people - index = rw_repo.index + index = rw_repo.index index.entries[manifest_key] = IndexEntry.from_base(manifest_fake_entry) index.write() assert rw_repo.index.entries[manifest_key].hexsha == Diff.NULL_HEX_SHA @@ -193,12 +193,12 @@ class TestIndex(TestBase): # write an unchanged index ( just for the fun of it ) rw_repo.index.write() - # a three way merge would result in a conflict and fails as the command will - # not overwrite any entries in our index and hence leave them unmerged. This is + # a three way merge would result in a conflict and fails as the command will + # not overwrite any entries in our index and hence leave them unmerged. This is # mainly a protection feature as the current index is not yet in a tree self.failUnlessRaises(GitCommandError, index.merge_tree, next_commit, base=parent_commit) - # the only way to get the merged entries is to safe the current index away into a tree, + # the only way to get the merged entries is to safe the current index away into a tree, # which is like a temporary commit for us. This fails as well as the NULL sha deos not # have a corresponding object # NOTE: missing_ok is not a kwarg anymore, missing_ok is always true @@ -225,7 +225,7 @@ class TestIndex(TestBase): # could sha it, or check stats # test diff - # resetting the head will leave the index in a different state, and the + # resetting the head will leave the index in a different state, and the # diff will yield a few changes cur_head_commit = rw_repo.head.reference.commit ref = rw_repo.head.reset('HEAD~6', index=True, working_tree=False) @@ -354,14 +354,14 @@ class TestIndex(TestBase): uname = "Some Developer" umail = "sd@company.com" rw_repo.config_writer().set_value("user", "name", uname) - rw_repo.config_writer().set_value("user", "email", umail) + rw_repo.config_writer().set_value("user", "email", umail) - # remove all of the files, provide a wild mix of paths, BaseIndexEntries, + # remove all of the files, provide a wild mix of paths, BaseIndexEntries, # IndexEntries def mixed_iterator(): count = 0 for entry in index.entries.itervalues(): - type_id = count % 4 + type_id = count % 4 if type_id == 0: # path yield entry.path elif type_id == 1: # blob @@ -373,7 +373,7 @@ class TestIndex(TestBase): else: raise AssertionError("Invalid Type") count += 1 - # END for each entry + # END for each entry # END mixed iterator deleted_files = index.remove(mixed_iterator(), working_tree=False) assert deleted_files @@ -446,13 +446,13 @@ class TestIndex(TestBase): self._assert_fprogress(entries) assert len(entries) > 1 - # glob + # glob entries = index.reset(new_commit).add([os.path.join('lib', 'git', '*.py')], fprogress=self._fprogress_add) self._assert_entries(entries) self._assert_fprogress(entries) assert len(entries) == 14 - # same file + # same file 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 @@ -469,7 +469,7 @@ class TestIndex(TestBase): entries = index.reset(new_commit).add([old_blob], fprogress=self._fprogress_add) self._assert_entries(entries) self._assert_fprogress(entries) - assert index.entries[(old_blob.path, 0)].hexsha == old_blob.hexsha and len(entries) == 1 + assert index.entries[(old_blob.path, 0)].hexsha == old_blob.hexsha and len(entries) == 1 # mode 0 not allowed null_hex_sha = Diff.NULL_HEX_SHA @@ -498,7 +498,7 @@ class TestIndex(TestBase): # we expect only the target to be written assert index.repo.odb.stream(entries[0].binsha).read() == target - # END real symlink test + # END real symlink test # add fake symlink and assure it checks-our as symlink fake_symlink_relapath = "my_fake_symlink" @@ -535,9 +535,9 @@ class TestIndex(TestBase): # on windows we will never get symlinks if os.name == 'nt': - # simlinks should contain the link as text ( which is what a + # simlinks should contain the link as text ( which is what a # symlink actually is ) - open(fake_symlink_path, 'rb').read() == link_target + open(fake_symlink_path, 'rb').read() == link_target else: assert S_ISLNK(os.lstat(fake_symlink_path)[ST_MODE]) @@ -553,7 +553,7 @@ class TestIndex(TestBase): files = ['AUTHORS', 'LICENSE'] self.failUnlessRaises(GitCommandError, index.move, files) - # again, with force + # again, with force assert_mv_rval(index.move(files, f=True)) # files into directory - dry run @@ -632,7 +632,7 @@ class TestIndex(TestBase): index.reset(working_tree=True, paths=files) - for fkey in keys: + for fkey in keys: assert fkey in index.entries for absfile in absfiles: assert os.path.isfile(absfile) @@ -650,7 +650,7 @@ class TestIndex(TestBase): index = rw_repo.index.reset(commit) orig_tree = commit.tree assert index.write_tree() == orig_tree - # END for each commit + # END for each commit def test_index_new(self): B = self.rorepo.tree("6d9b1f4f9fa8c9f030e3207e7deacc5d5f8bba4e") diff --git a/git/test/test_reflog.py b/git/test/test_reflog.py index a68b25a3..fec50095 100644 --- a/git/test/test_reflog.py +++ b/git/test/test_reflog.py @@ -35,7 +35,7 @@ class TestRefLog(TestBase): tdir = tempfile.mktemp(suffix="test_reflogs") os.mkdir(tdir) - rlp_master_ro = RefLog.path(self.rorepo.head) + rlp_master_ro = RefLog.path(self.rorepo.head) assert os.path.isfile(rlp_master_ro) # simple read @@ -94,7 +94,7 @@ class TestRefLog(TestBase): for idx in (-1, -24): RefLog.entry_at(rlp, idx) #END for each index to read - # END for each reflog + # END for each reflog # finally remove our temporary data shutil.rmtree(tdir) diff --git a/git/test/test_refs.py b/git/test/test_refs.py index f4f8b9d8..ee9d8074 100644 --- a/git/test/test_refs.py +++ b/git/test/test_refs.py @@ -23,7 +23,7 @@ class TestRefs(TestBase): full_path = ref_type.to_full_path(name) instance = ref_type.from_path(self.rorepo, full_path) assert isinstance(instance, ref_type) - # END for each name + # END for each name # END for each type # invalid path @@ -42,7 +42,7 @@ class TestRefs(TestBase): tagobj = tag.tag # have no dict self.failUnlessRaises(AttributeError, setattr, tagobj, 'someattr', 1) - assert isinstance(tagobj, TagObject) + assert isinstance(tagobj, TagObject) assert tagobj.tag == tag.name assert isinstance(tagobj.tagger, Actor) assert isinstance(tagobj.tagged_date, int) @@ -152,7 +152,7 @@ class TestRefs(TestBase): types_found = set() for ref in self.rorepo.refs: types_found.add(type(ref)) - assert len(types_found) >= 3 + assert len(types_found) >= 3 def test_is_valid(self): assert Reference(self.rorepo, 'refs/doesnt/exist').is_valid() == False @@ -187,7 +187,7 @@ class TestRefs(TestBase): cur_head.reset(new_head_commit) rw_repo.index.checkout(["lib"], force=True) - # now that we have a write write repo, change the HEAD reference - its + # now that we have a write write repo, change the HEAD reference - its # like git-reset --soft heads = rw_repo.heads assert heads @@ -212,7 +212,7 @@ class TestRefs(TestBase): cur_head.reference = some_tag assert not cur_head.is_detached assert cur_head.commit == some_tag.commit - assert isinstance(cur_head.reference, TagReference) + assert isinstance(cur_head.reference, TagReference) # put HEAD back to a real head, otherwise everything else fails cur_head.reference = active_head @@ -220,7 +220,7 @@ class TestRefs(TestBase): # type check self.failUnlessRaises(ValueError, setattr, cur_head, "reference", "that") - # head handling + # head handling commit = 'HEAD' prev_head_commit = cur_head.commit for count, new_name in enumerate(("my_new_head", "feature/feature1")): @@ -286,7 +286,7 @@ class TestRefs(TestBase): # remote deletion remote_refs_so_far = 0 - remotes = rw_repo.remotes + remotes = rw_repo.remotes assert remotes for remote in remotes: refs = remote.refs @@ -330,7 +330,7 @@ class TestRefs(TestBase): head.object = head_tree assert head.object == head_tree # cannot query tree as commit - self.failUnlessRaises(TypeError, getattr, head, 'commit') + self.failUnlessRaises(TypeError, getattr, head, 'commit') # set the commit directly using the head. This would never detach the head assert not cur_head.is_detached @@ -422,7 +422,7 @@ class TestRefs(TestBase): assert symref.reference == cur_head.reference self.failUnlessRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference.commit) - # it works if the new ref points to the same reference + # it works if the new ref points to the same reference SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path SymbolicReference.delete(rw_repo, symref) # would raise if the symref wouldn't have been deletedpbl @@ -467,7 +467,7 @@ class TestRefs(TestBase): assert not symref.is_detached # when iterating references, we can get references and symrefs - # when deleting all refs, I'd expect them to be gone ! Even from + # when deleting all refs, I'd expect them to be gone ! Even from # the packed ones # For this to work, we must not be on any branch rw_repo.head.reference = rw_repo.head.commit @@ -485,7 +485,7 @@ class TestRefs(TestBase): assert ref not in deleted_refs # END for each ref - # reattach head - head will not be returned if it is not a symbolic + # reattach head - head will not be returned if it is not a symbolic # ref rw_repo.head.reference = Head.create(rw_repo, "master") @@ -496,7 +496,7 @@ class TestRefs(TestBase): # test creation of new refs from scratch for path in ("basename", "dir/somename", "dir2/subdir/basename"): - # REFERENCES + # REFERENCES ############ fpath = Reference.to_full_path(path) ref_fp = Reference.from_path(rw_repo, fpath) diff --git a/git/test/test_remote.py b/git/test/test_remote.py index 638349ba..a5a73ce1 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -12,7 +12,7 @@ import shutil import os import random -# assure we have repeatable results +# assure we have repeatable results random.seed(0) @@ -84,13 +84,13 @@ class TestRemote(TestBase): assert isinstance(info.note, basestring) if isinstance(info.ref, Reference): assert info.flags != 0 - # END reference type flags handling + # END reference type flags handling assert isinstance(info.ref, (SymbolicReference, Reference)) if info.flags & (info.FORCED_UPDATE | info.FAST_FORWARD): assert isinstance(info.old_commit, Commit) else: assert info.old_commit is None - # END forced update checking + # END forced update checking # END for each info def _do_test_push_result(self, results, remote): @@ -108,13 +108,13 @@ class TestRemote(TestBase): assert has_one else: # there must be a remote commit - if info.flags & info.DELETED == 0: + if info.flags & info.DELETED == 0: assert isinstance(info.local_ref, Reference) else: assert info.local_ref is None assert type(info.remote_ref) in (TagReference, RemoteReference) # END error checking - # END for each info + # END for each info def _do_test_fetch_info(self, repo): self.failUnlessRaises(ValueError, FetchInfo._from_line, repo, "nonsense", '') @@ -222,7 +222,7 @@ class TestRemote(TestBase): res = fetch_and_test(remote, tags=True) self.failUnlessRaises(IndexError, get_info, res, remote, str(rtag)) - # provoke to receive actual objects to see what kind of output we have to + # provoke to receive actual objects to see what kind of output we have to # expect. For that we need a remote transport protocol # Create a new UN-shared repo and fetch into it after we pushed a change # to the shared repo @@ -233,7 +233,7 @@ class TestRemote(TestBase): remote_repo_url = "git://localhost%s" % remote_repo.git_dir # put origin to git-url - other_origin = other_repo.remotes.origin + other_origin = other_repo.remotes.origin other_origin.config_writer.set("url", remote_repo_url) # it automatically creates alternates as remote_repo is shared as well. # It will use the transport though and ignore alternates when fetching @@ -245,8 +245,8 @@ class TestRemote(TestBase): self._commit_random_file(rw_repo) remote.push(rw_repo.head.reference) - # here I would expect to see remote-information about packing - # objects and so on. Unfortunately, this does not happen + # here I would expect to see remote-information about packing + # objects and so on. Unfortunately, this does not happen # if we are redirecting the output - git explicitly checks for this # and only provides progress information to ttys res = fetch_and_test(other_origin) @@ -262,10 +262,10 @@ class TestRemote(TestBase): try: lhead.reference = rw_repo.heads.master except AttributeError: - # if the author is on a non-master branch, the clones might not have + # if the author is on a non-master branch, the clones might not have # a local master yet. We simply create it lhead.reference = rw_repo.create_head('master') - # END master handling + # END master handling lhead.reset(remote.refs.master, working_tree=True) # push without spec should fail ( without further configuration ) @@ -283,13 +283,13 @@ class TestRemote(TestBase): # rejected - undo last commit lhead.reset("HEAD~1") res = remote.push(lhead.reference) - assert res[0].flags & PushInfo.ERROR + assert res[0].flags & PushInfo.ERROR assert res[0].flags & PushInfo.REJECTED self._do_test_push_result(res, remote) # force rejected pull res = remote.push('+%s' % lhead.reference) - assert res[0].flags & PushInfo.ERROR == 0 + assert res[0].flags & PushInfo.ERROR == 0 assert res[0].flags & PushInfo.FORCED_UPDATE self._do_test_push_result(res, remote) @@ -297,7 +297,7 @@ class TestRemote(TestBase): res = remote.push("hellothere") assert len(res) == 0 - # push new tags + # push new tags progress = TestRemoteProgress() to_be_updated = "my_tag.1.0RV" new_tag = TagReference.create(rw_repo, to_be_updated) @@ -322,7 +322,7 @@ class TestRemote(TestBase): res = remote.push(":%s" % new_tag.path) self._do_test_push_result(res, remote) assert res[0].flags & PushInfo.DELETED - # Currently progress is not properly transferred, especially not using + # Currently progress is not properly transferred, especially not using # the git daemon # progress.assert_received_message() @@ -346,7 +346,7 @@ class TestRemote(TestBase): remote.pull('master') - # cleanup - delete created tags and branches as we are in an innerloop on + # cleanup - delete created tags and branches as we are in an innerloop on # the same repository TagReference.delete(rw_repo, new_tag, other_tag) remote.push(":%s" % other_tag.path) @@ -364,7 +364,7 @@ class TestRemote(TestBase): remote_set.add(remote) remote_set.add(remote) # should already exist - # REFS + # REFS refs = remote.refs assert refs for ref in refs: @@ -392,9 +392,9 @@ class TestRemote(TestBase): assert writer.get(opt) == val del(writer) assert getattr(remote, opt) == val - # END for each default option key + # END for each default option key - # RENAME + # RENAME other_name = "totally_other_name" prev_name = remote.name assert remote.rename(other_name) == remote @@ -408,12 +408,12 @@ class TestRemote(TestBase): self._assert_push_and_pull(remote, rw_repo, remote_repo) # FETCH TESTING - # Only for remotes - local cases are the same or less complicated + # Only for remotes - local cases are the same or less complicated # as additional progress information will never be emitted if remote.name == "daemon_origin": self._do_test_fetch(remote, rw_repo, remote_repo) ran_fetch_test = True - # END fetch test + # END fetch test remote.update() # END for each remote @@ -449,7 +449,7 @@ 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", + remote_info_line_fmt % "local/master", fetch_info_line_fmt % 'remote-tracking branch') assert fi.ref.is_valid() assert fi.ref.commit @@ -458,7 +458,7 @@ 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", + remote_info_line_fmt % "subdir/tagname", fetch_info_line_fmt % 'tag') assert isinstance(fi.ref, TagReference) @@ -466,7 +466,7 @@ class TestRemote(TestBase): # it could be in a remote direcftory though fi = FetchInfo._from_line(self.rorepo, - remote_info_line_fmt % "remotename/tags/tagname", + remote_info_line_fmt % "remotename/tags/tagname", fetch_info_line_fmt % 'tag') assert isinstance(fi.ref, TagReference) @@ -475,7 +475,7 @@ 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, + remote_info_line_fmt % tag_path, fetch_info_line_fmt % 'tag') assert isinstance(fi.ref, TagReference) @@ -483,7 +483,7 @@ class TestRemote(TestBase): # branches default to refs/remotes fi = FetchInfo._from_line(self.rorepo, - remote_info_line_fmt % "remotename/branch", + remote_info_line_fmt % "remotename/branch", fetch_info_line_fmt % 'branch') assert isinstance(fi.ref, RemoteReference) @@ -491,7 +491,7 @@ class TestRemote(TestBase): # 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", + remote_info_line_fmt % "refs/something/branch", fetch_info_line_fmt % 'branch') assert type(fi.ref) is Reference diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 86d355e6..d6568d0b 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -53,14 +53,14 @@ class TestRepo(TestBase): for head in self.rorepo.heads: assert head.name assert isinstance(head.commit, Commit) - # END for each head + # END for each head assert isinstance(self.rorepo.heads.master, Head) assert isinstance(self.rorepo.heads['master'], Head) def test_tree_from_revision(self): tree = self.rorepo.tree('0.1.6') - assert len(tree.hexsha) == 40 + assert len(tree.hexsha) == 40 assert tree.type == "tree" assert self.rorepo.tree(tree) == tree @@ -104,7 +104,7 @@ class TestRepo(TestBase): assert num_trees == mc def _assert_empty_repo(self, repo): - # test all kinds of things with an empty, freshly initialized repo. + # test all kinds of things with an empty, freshly initialized repo. # It should throw good errors # entries should be empty @@ -123,7 +123,7 @@ class TestRepo(TestBase): # is_dirty can handle all kwargs for args in ((1, 0, 0), (0, 1, 0), (0, 0, 1)): assert not repo.is_dirty(*args) - # END for each arg + # END for each arg # we can add a file to the index ( if we are not bare ) if not repo.bare: @@ -216,7 +216,7 @@ class TestRepo(TestBase): orig_value = self.rorepo._bare self.rorepo._bare = True assert_false(self.rorepo.is_dirty()) - self.rorepo._bare = orig_value + self.rorepo._bare = orig_value def test_is_dirty(self): self.rorepo._bare = False @@ -285,7 +285,7 @@ class TestRepo(TestBase): def test_untracked_files(self): base = self.rorepo.working_tree_dir - files = (join_path_native(base, "__test_myfile"), + files = (join_path_native(base, "__test_myfile"), join_path_native(base, "__test_other_file")) num_recently_untracked = 0 try: @@ -305,12 +305,12 @@ class TestRepo(TestBase): for fpath in files: if os.path.isfile(fpath): os.remove(fpath) - # END handle files + # END handle files assert len(self.rorepo.untracked_files) == (num_recently_untracked - len(files)) def test_config_reader(self): - reader = self.rorepo.config_reader() # all config files + reader = self.rorepo.config_reader() # all config files assert reader.read_only reader = self.rorepo.config_reader("repository") # single config file assert reader.read_only @@ -321,13 +321,13 @@ class TestRepo(TestBase): writer = self.rorepo.config_writer(config_level) assert not writer.read_only except IOError: - # its okay not to get a writer for some configuration files if we + # its okay not to get a writer for some configuration files if we # have no permissions - pass - # END for each config level + pass + # END for each config level def test_creation_deletion(self): - # just a very quick test to assure it generally works. There are + # just a very quick test to assure it generally works. There are # specialized cases in the test_refs module head = self.rorepo.create_head("new_head", "HEAD~1") self.rorepo.delete_head(head) @@ -348,7 +348,7 @@ class TestRepo(TestBase): # last \n is the terminating newline that it expects l1 = "0123456789\n" l2 = "abcdefghijklmnopqrstxy\n" - l3 = "z\n" + l3 = "z\n" d = "%s%s%s\n" % (l1, l2, l3) l1p = l1[:5] @@ -441,7 +441,7 @@ class TestRepo(TestBase): obj = orig_obj.object else: obj = orig_obj - # END deref tags by default + # END deref tags by default # try history rev = name + "~" @@ -496,7 +496,7 @@ class TestRepo(TestBase): for ref in Reference.iter_items(self.rorepo): path_tokens = ref.path.split("/") for pt in range(len(path_tokens)): - path_section = '/'.join(path_tokens[-(pt + 1):]) + path_section = '/'.join(path_tokens[-(pt + 1):]) try: obj = self._assert_rev_parse(path_section) assert obj.type == ref.object.type diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 3f7ac39d..0ecb5c1f 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -45,7 +45,7 @@ class TestSubmodule(TestBase): # manual instantiation smm = Submodule(rwrepo, "\0" * 20) # name needs to be set in advance - self.failUnlessRaises(AttributeError, getattr, smm, 'name') + self.failUnlessRaises(AttributeError, getattr, smm, 'name') # iterate - 1 submodule sms = Submodule.list_items(rwrepo, self.k_subm_current) @@ -83,8 +83,8 @@ class TestSubmodule(TestBase): # test config_reader/writer methods sm.config_reader() - new_smclone_path = None # keep custom paths for later - new_csmclone_path = None # + new_smclone_path = None # keep custom paths for later + new_csmclone_path = None # if rwrepo.bare: self.failUnlessRaises(InvalidGitRepositoryError, sm.config_writer) else: @@ -110,7 +110,7 @@ class TestSubmodule(TestBase): smold.set_parent_commit(self.k_subm_changed + "~1") assert smold.binsha != sm.binsha - # raises if the sm didn't exist in new parent - it keeps its + # raises if the sm didn't exist in new parent - it keeps its # parent_commit unchanged self.failUnlessRaises(ValueError, smold.set_parent_commit, self.k_no_subm_tag) @@ -214,7 +214,7 @@ class TestSubmodule(TestBase): repo.head.reset('HEAD~2', working_tree=1) # END for each repo to reset - # dry run does nothing + # dry run does nothing sm.update(recursive=True, dry_run=True, progress=prog) for repo in smods: assert repo.head.commit != repo.head.ref.tracking_branch().commit @@ -324,7 +324,7 @@ class TestSubmodule(TestBase): rwrepo.index.commit("my submod commit") assert len(rwrepo.submodules) == 2 - # needs update as the head changed, it thinks its in the history + # needs update as the head changed, it thinks its in the history # of the repo otherwise nsm.set_parent_commit(rwrepo.head.commit) osm.set_parent_commit(rwrepo.head.commit) @@ -369,7 +369,7 @@ class TestSubmodule(TestBase): for remote in osmod.remotes: remote.remove(osmod, remote.name) assert not osm.exists() - self.failUnlessRaises(ValueError, Submodule.add, rwrepo, osmid, csm_repopath, url=None) + self.failUnlessRaises(ValueError, Submodule.add, rwrepo, osmid, csm_repopath, url=None) # END handle bare mode # Error if there is no submodule file here @@ -424,7 +424,7 @@ class TestSubmodule(TestBase): prep = sm.path assert not sm.module_exists() # was never updated after rwrepo's clone - # assure we clone from a local source + # 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))) # dry-run does nothing @@ -491,9 +491,9 @@ class TestSubmodule(TestBase): rm.update(recursive=False) assert not os.path.isdir(smp) - # change url + # change url #============= - # to the first repository, this way we have a fast checkout, and a completely different + # to the first repository, this way we have a fast checkout, and a completely different # repository at the different url nsm.set_parent_commit(csmremoved) nsmurl = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsmsp[0])) @@ -519,7 +519,7 @@ class TestSubmodule(TestBase): # change branch #================= - # we only have one branch, so we switch to a virtual one, and back + # we only have one branch, so we switch to a virtual one, and back # to the current one to trigger the difference cur_branch = nsm.branch nsmm = nsm.module() @@ -552,7 +552,7 @@ class TestSubmodule(TestBase): assert len(nsm.children()) >= 1 # could include smmap assert nsm.exists() and nsm.module_exists() and len(nsm.children()) >= 1 # assure we pull locally only - nsmc = nsm.children()[0] + nsmc = nsm.children()[0] nsmc.config_writer().set_value('url', async_url) rm.update(recursive=True, progress=prog, dry_run=True) # just to run the code rm.update(recursive=True, progress=prog) diff --git a/git/test/test_tree.py b/git/test/test_tree.py index e3743c2d..0f1fb7c3 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -137,7 +137,7 @@ class TestTree(TestBase): found_slash = True # END check for slash - # slashes in paths are supported as well + # slashes in paths are supported as well assert root[item.path] == item == root / item.path # END for each item assert found_slash |