diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 000000000..1dbc38786 --- /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 a75826eb3..384f7c5fc 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -864,9 +864,8 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False): 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 93f94748a..83e510be4 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -38,7 +38,7 @@ def setUp(self): 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 4a189267e..357d9edb3 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -134,15 +134,18 @@ def test_it_accepts_environment_variables(self): 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 @@ def test_persistent_cat_file_command(self): # 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 @@ def test_environment(self, rw_dir): 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 c74d4ef41..94f9fdf80 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -90,7 +90,7 @@ def setUp(self): 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 7ca0564eb..b3963d3bf 100644 --- a/git/util.py +++ b/git/util.py @@ -98,9 +98,8 @@ def onerror(func, path, exc_info): 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)