diff options
-rw-r--r-- | git/test/test_base.py | 13 | ||||
-rw-r--r-- | git/test/test_git.py | 7 |
2 files changed, 18 insertions, 2 deletions
diff --git a/git/test/test_base.py b/git/test/test_base.py index 301384ef..f581138b 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -118,5 +118,16 @@ class TestBase(TestBase): file_path = os.path.join(rw_repo.working_dir, filename) open(file_path, "wb").write(b'something') - rw_repo.git.add(rw_repo.working_dir) + + if os.name == 'nt': + # on windows, there is no way this works, see images on + # https://github.com/gitpython-developers/GitPython/issues/147#issuecomment-68881897 + # Therefore, it must be added using the python implementation + rw_repo.index.add([file_path]) + # However, when the test winds down, rmtree fails to delete this file, which is recognized + # as ??? only. + else: + # on posix, we can just add unicode files without problems + rw_repo.git.add(rw_repo.working_dir) + # end rw_repo.index.commit('message') diff --git a/git/test/test_git.py b/git/test/test_git.py index 502e6091..f25fa21a 100644 --- a/git/test/test_git.py +++ b/git/test/test_git.py @@ -121,11 +121,16 @@ class TestGit(TestBase): def test_cmd_override(self): prev_cmd = self.git.GIT_PYTHON_GIT_EXECUTABLE + if os.name == 'nt': + exc = GitCommandError + else: + exc = OSError + # end handle windows case try: # set it to something that doens't exist, assure it raises type(self.git).GIT_PYTHON_GIT_EXECUTABLE = os.path.join( "some", "path", "which", "doesn't", "exist", "gitbinary") - self.failUnlessRaises(OSError, self.git.version) + self.failUnlessRaises(exc, self.git.version) finally: type(self.git).GIT_PYTHON_GIT_EXECUTABLE = prev_cmd # END undo adjustment |