summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Solanki <mohitsolanki619@gmail.com>2019-09-10 13:26:55 +0530
committerSebastian Thiel <byronimo@gmail.com>2019-09-10 13:15:09 +0200
commita2d8a5144bd8c0940d9f2593a21aec8bebf7c035 (patch)
treee7a7874da27245018b7cee9efeccc1622023859c
parent07657929bc6c0339d4d2e7e1dde1945199374b90 (diff)
downloadgitpython-a2d8a5144bd8c0940d9f2593a21aec8bebf7c035.tar.gz
Fix #889: Add DeepSource config and fix some major issues
-rw-r--r--.deepsource.toml15
-rw-r--r--git/objects/submodule/base.py5
-rw-r--r--git/test/test_config.py2
-rw-r--r--git/test/test_git.py13
-rw-r--r--git/test/test_repo.py2
-rw-r--r--git/util.py5
6 files changed, 29 insertions, 13 deletions
diff --git a/.deepsource.toml b/.deepsource.toml
new file mode 100644
index 00000000..1dbc3878
--- /dev/null
+++ b/.deepsource.toml
@@ -0,0 +1,15 @@
+version = 1
+
+test_patterns = [
+ 'git/test/**/test_*.py'
+]
+
+exclude_patterns = [
+ 'doc/**',
+ 'etc/sublime-text'
+]
+
+[[analyzers]]
+name = 'python'
+enabled = true
+runtime_version = '2.x.x'
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index a75826eb..384f7c5f 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -864,9 +864,8 @@ class Submodule(IndexObject, Iterable, Traversable):
rmtree(wtd)
except Exception as ex:
if HIDE_WINDOWS_KNOWN_ERRORS:
- raise SkipTest("FIXME: fails with: PermissionError\n %s", ex)
- else:
- raise
+ raise SkipTest("FIXME: fails with: PermissionError\n {}".format(ex))
+ raise
# END delete tree if possible
# END handle force
diff --git a/git/test/test_config.py b/git/test/test_config.py
index 93f94748..83e510be 100644
--- a/git/test/test_config.py
+++ b/git/test/test_config.py
@@ -38,7 +38,7 @@ class TestBase(TestCase):
def tearDown(self):
for lfp in glob.glob(_tc_lock_fpaths):
if osp.isfile(lfp):
- raise AssertionError('Previous TC left hanging git-lock file: %s', lfp)
+ raise AssertionError('Previous TC left hanging git-lock file: {}'.format(lfp))
def _to_memcache(self, file_path):
with open(file_path, "rb") as fp:
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 4a189267..357d9edb 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -134,15 +134,18 @@ class TestGit(TestBase):
def test_persistent_cat_file_command(self):
# read header only
- import subprocess as sp
hexsha = "b2339455342180c7cc1e9bba3e9f181f7baa5167"
- g = self.git.cat_file(batch_check=True, istream=sp.PIPE, as_process=True)
+ g = self.git.cat_file(
+ batch_check=True, istream=subprocess.PIPE, as_process=True
+ )
g.stdin.write(b"b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
g.stdin.flush()
obj_info = g.stdout.readline()
# read header + data
- g = self.git.cat_file(batch=True, istream=sp.PIPE, as_process=True)
+ g = self.git.cat_file(
+ batch=True, istream=subprocess.PIPE, as_process=True
+ )
g.stdin.write(b"b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
g.stdin.flush()
obj_info_two = g.stdout.readline()
@@ -160,7 +163,7 @@ class TestGit(TestBase):
# same can be achieved using the respective command functions
hexsha, typename, size = self.git.get_object_header(hexsha)
- hexsha, typename_two, size_two, data = self.git.get_object_data(hexsha) # @UnusedVariable
+ hexsha, typename_two, size_two, _ = self.git.get_object_data(hexsha)
self.assertEqual(typename, typename_two)
self.assertEqual(size, size_two)
@@ -264,7 +267,7 @@ class TestGit(TestBase):
remote.fetch()
except GitCommandError as err:
if sys.version_info[0] < 3 and is_darwin:
- self.assertIn('ssh-orig, ' in str(err))
+ self.assertIn('ssh-orig', str(err))
self.assertEqual(err.status, 128)
else:
self.assertIn('FOO', str(err))
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index c74d4ef4..94f9fdf8 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -90,7 +90,7 @@ class TestRepo(TestBase):
def tearDown(self):
for lfp in glob.glob(_tc_lock_fpaths):
if osp.isfile(lfp):
- raise AssertionError('Previous TC left hanging git-lock file: %s', lfp)
+ raise AssertionError('Previous TC left hanging git-lock file: {}'.format(lfp))
import gc
gc.collect()
diff --git a/git/util.py b/git/util.py
index 7ca0564e..b3963d3b 100644
--- a/git/util.py
+++ b/git/util.py
@@ -98,9 +98,8 @@ def rmtree(path):
func(path) # Will scream if still not possible to delete.
except Exception as ex:
if HIDE_WINDOWS_KNOWN_ERRORS:
- raise SkipTest("FIXME: fails with: PermissionError\n %s", ex)
- else:
- raise
+ raise SkipTest("FIXME: fails with: PermissionError\n {}".format(ex))
+ raise
return shutil.rmtree(path, False, onerror)