From a469af892b3e929cbe9d29e414b6fcd59bec246e Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Mon, 3 Oct 2016 23:35:55 +0200 Subject: src: No PyDev warnings + Mark all unused vars and other non-pep8 (PyDev) warnings + test_utils: + enable & fix forgotten IterableList looped path. + unittestize all assertions. + remote: minor fix progress dispatching unknown err-lines --- git/test/lib/asserts.py | 14 ++-- git/test/performance/test_streams.py | 4 +- git/test/test_commit.py | 2 +- git/test/test_docs.py | 11 ++-- git/test/test_exc.py | 14 ++-- git/test/test_git.py | 4 +- git/test/test_index.py | 4 +- git/test/test_refs.py | 4 +- git/test/test_remote.py | 6 +- git/test/test_repo.py | 2 +- git/test/test_submodule.py | 6 +- git/test/test_util.py | 122 +++++++++++++++++++---------------- 12 files changed, 101 insertions(+), 92 deletions(-) (limited to 'git/test') diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py index 9edc49e0..6f5ba714 100644 --- a/git/test/lib/asserts.py +++ b/git/test/lib/asserts.py @@ -8,18 +8,18 @@ import re import stat from nose.tools import ( - assert_equal, - assert_not_equal, - assert_raises, - raises, - assert_true, - assert_false + assert_equal, # @UnusedImport + assert_not_equal, # @UnusedImport + assert_raises, # @UnusedImport + raises, # @UnusedImport + assert_true, # @UnusedImport + assert_false # @UnusedImport ) try: from unittest.mock import patch except ImportError: - from mock import patch + from mock import patch # @NoMove @UnusedImport __all__ = ['assert_instance_of', 'assert_not_instance_of', 'assert_none', 'assert_not_none', diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py index 8194547c..42cbade5 100644 --- a/git/test/performance/test_streams.py +++ b/git/test/performance/test_streams.py @@ -120,7 +120,7 @@ class TestObjDBPerformance(TestBigRepoR): # read all st = time() - s, t, size, data = rwrepo.git.get_object_data(gitsha) + hexsha, typename, size, data = rwrepo.git.get_object_data(gitsha) # @UnusedVariable gelapsed_readall = time() - st print("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), file=sys.stderr) @@ -131,7 +131,7 @@ class TestObjDBPerformance(TestBigRepoR): # read chunks st = time() - s, t, size, stream = rwrepo.git.stream_object_data(gitsha) + hexsha, typename, size, stream = rwrepo.git.stream_object_data(gitsha) # @UnusedVariable while True: data = stream.read(cs) if len(data) < cs: diff --git a/git/test/test_commit.py b/git/test/test_commit.py index 66d988a3..fd9777fb 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -123,7 +123,7 @@ class TestCommit(TestBase): check_entries(stats.total) assert "files" in stats.total - for filepath, d in stats.files.items(): + for filepath, d in stats.files.items(): # @UnusedVariable check_entries(d) # END for each stated file diff --git a/git/test/test_docs.py b/git/test/test_docs.py index 6e505dd9..5c7ae7f0 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -70,7 +70,8 @@ class Tutorials(TestBase): # heads, tags and references # heads are branches in git-speak # [8-test_init_repo_object] - self.assertEqual(repo.head.ref, repo.heads.master) # head is a sym-ref pointing to master + self.assertEqual(repo.head.ref, repo.heads.master, # head is a sym-ref pointing to master + "It's ok if TC not running from `master`.") self.assertEqual(repo.tags['0.3.5'], repo.tag('refs/tags/0.3.5')) # you can access tags in various ways too self.assertEqual(repo.refs.master, repo.heads['master']) # .refs provides all refs, ie heads ... @@ -242,9 +243,9 @@ class Tutorials(TestBase): # [8-test_references_and_objects] hc = repo.head.commit hct = hc.tree - hc != hct - hc != repo.tags[0] - hc == repo.head.reference.commit + hc != hct # @NoEffect + hc != repo.tags[0] # @NoEffect + hc == repo.head.reference.commit # @NoEffect # ![8-test_references_and_objects] # [9-test_references_and_objects] @@ -347,7 +348,7 @@ class Tutorials(TestBase): # The index contains all blobs in a flat list assert len(list(index.iter_blobs())) == len([o for o in repo.head.commit.tree.traverse() if o.type == 'blob']) # Access blob objects - for (path, stage), entry in index.entries.items(): + for (path, stage), entry in index.entries.items(): # @UnusedVariable pass new_file_path = os.path.join(repo.working_tree_dir, 'new-file-name') open(new_file_path, 'w').close() diff --git a/git/test/test_exc.py b/git/test/test_exc.py index 7e6b023e..33f44034 100644 --- a/git/test/test_exc.py +++ b/git/test/test_exc.py @@ -29,13 +29,13 @@ _cmd_argvs = ( ('θνιψοδε', 'κι', 'αλλα', 'non-unicode', 'args'), ) _causes_n_substrings = ( - (None, None), # noqa: E241 - (7, "exit code(7)"), # noqa: E241 - ('Some string', "'Some string'"), # noqa: E241 - ('παλιο string', "'παλιο string'"), # noqa: E241 - (Exception("An exc."), "Exception('An exc.')"), # noqa: E241 - (Exception("Κακια exc."), "Exception('Κακια exc.')"), # noqa: E241 - (object(), "