◐ Shell
clean mode source ↗

Upgrade and broaden flake8, fixing style problems and bugs by EliahKagan · Pull Request #1673 · gitpython-developers/GitPython

Expand Up @@ -252,7 +252,8 @@ def test_clone_from_with_path_contains_unicode(self):
@with_rw_directory @skip( "the referenced repository was removed, and one needs to setup a new password controlled repo under the orgs control" """The referenced repository was removed, and one needs to set up a new password controlled repo under the org's control.""" ) def test_leaking_password_in_clone_logs(self, rw_dir): password = "fakepassword1234" Expand Down Expand Up @@ -758,9 +759,9 @@ def test_blame_complex_revision(self, git):
@mock.patch.object(Git, "_call_process") def test_blame_accepts_rev_opts(self, git): res = self.rorepo.blame("HEAD", "README.md", rev_opts=["-M", "-C", "-C"]) expected_args = ["blame", "HEAD", "-M", "-C", "-C", "--", "README.md"] boilerplate_kwargs = {"p": True, "stdout_as_string": False} self.rorepo.blame("HEAD", "README.md", rev_opts=["-M", "-C", "-C"]) git.assert_called_once_with(*expected_args, **boilerplate_kwargs)
@skipIf( Expand Down Expand Up @@ -846,18 +847,13 @@ def test_comparison_and_hash(self):
@with_rw_directory def test_tilde_and_env_vars_in_repo_path(self, rw_dir): ph = os.environ.get("HOME") try: with mock.patch.dict(os.environ, {"HOME": rw_dir}): os.environ["HOME"] = rw_dir Repo.init(osp.join("~", "test.git"), bare=True)
with mock.patch.dict(os.environ, {"FOO": rw_dir}): os.environ["FOO"] = rw_dir Repo.init(osp.join("$FOO", "test.git"), bare=True) finally: if ph: os.environ["HOME"] = ph del os.environ["FOO"] # end assure HOME gets reset to what it was
def test_git_cmd(self): # test CatFileContentStream, just to be very sure we have no fencepost errors Expand Down Expand Up @@ -971,7 +967,7 @@ def _assert_rev_parse(self, name): # history with number ni = 11 history = [obj.parents[0]] for pn in range(ni): for _ in range(ni): history.append(history[-1].parents[0]) # END get given amount of commits
Expand Down Expand Up @@ -1329,6 +1325,7 @@ def test_git_work_tree_env(self, rw_dir): # move .git directory to a subdirectory # set GIT_DIR and GIT_WORK_TREE appropriately # check that repo.working_tree_dir == rw_dir
self.rorepo.clone(join_path_native(rw_dir, "master_repo"))
repo_dir = join_path_native(rw_dir, "master_repo") Expand All @@ -1338,16 +1335,12 @@ def test_git_work_tree_env(self, rw_dir): os.mkdir(new_subdir) os.rename(old_git_dir, new_git_dir)
oldenv = os.environ.copy() os.environ["GIT_DIR"] = new_git_dir os.environ["GIT_WORK_TREE"] = repo_dir to_patch = {"GIT_DIR": new_git_dir, "GIT_WORK_TREE": repo_dir}
try: with mock.patch.dict(os.environ, to_patch): r = Repo() self.assertEqual(r.working_tree_dir, repo_dir) self.assertEqual(r.working_dir, repo_dir) finally: os.environ = oldenv
@with_rw_directory def test_rebasing(self, rw_dir): Expand Down