From f1b8d0c92e4b5797b95948bdb95bec7756f5189f Mon Sep 17 00:00:00 2001 From: Benjamin Poldrack Date: Tue, 18 Oct 2016 16:07:54 +0200 Subject: Add a test for persistent git options --- git/test/test_git.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'git/test') diff --git a/git/test/test_git.py b/git/test/test_git.py index bd8ebee2..ef327c6d 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -160,6 +160,20 @@ class TestGit(TestBase): git_command_version = self.git.version() self.assertEquals(git_version, git_command_version) + def test_persistent_options(self): + git_command_version = self.git.version() + # analog to test_options_are_passed_to_git + self.git.set_persistent_git_options(version=True) + git_version = self.git.NoOp() + self.assertEquals(git_version, git_command_version) + # subsequent calls keep this option: + git_version_2 = self.git.NoOp() + self.assertEquals(git_version_2, git_command_version) + + # reset to empty: + self.git.set_persistent_git_options() + self.assertRaises(GitCommandError, self.git.NoOp) + def test_single_char_git_options_are_passed_to_git(self): input_value = 'TestValue' output_value = self.git(c='user.name=%s' % input_value).config('--get', 'user.name') -- cgit v1.2.1 From bf8ce9464987c7b0dbe6acbc2cc2653e98ec739a Mon Sep 17 00:00:00 2001 From: Benjamin Poldrack Date: Wed, 19 Oct 2016 12:56:57 +0200 Subject: Fix flake8 error --- git/test/test_git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test') diff --git a/git/test/test_git.py b/git/test/test_git.py index ef327c6d..14c70e18 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -172,7 +172,7 @@ class TestGit(TestBase): # reset to empty: self.git.set_persistent_git_options() - self.assertRaises(GitCommandError, self.git.NoOp) + self.assertRaises(GitCommandError, self.git.NoOp) def test_single_char_git_options_are_passed_to_git(self): input_value = 'TestValue' -- cgit v1.2.1 From 9d5d143f72e4d588e3a0abb2ab82fa5a2c35e8aa Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Wed, 19 Oct 2016 16:01:47 +0200 Subject: repo: minor code and doc correcions. + Expansion of paths also `osp.normalize()` them. + Make Repo-fields --> class-fields to avoid initializations on construct. + Explain and rename `git.repo.fun.find_git_dir()` is for submodules (`find_submodule_git_dir()`). --- git/test/test_submodule.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/test') diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 9db4f9c9..39040ced 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -14,7 +14,7 @@ from git.exc import ( from git.objects.submodule.base import Submodule from git.objects.submodule.root import RootModule, RootUpdateProgress from git.repo.fun import ( - find_git_dir, + find_submodule_git_dir, touch ) from git.test.lib import ( @@ -757,7 +757,7 @@ class TestSubmodule(TestBase): else: assert osp.isfile(module_repo_path) assert sm.module().has_separate_working_tree() - assert find_git_dir(module_repo_path) is not None, "module pointed to by .git file must be valid" + assert find_submodule_git_dir(module_repo_path) is not None, "module pointed to by .git file must be valid" # end verify submodule 'style' # test move -- cgit v1.2.1