Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d0ad08

Browse files
committed
Improved windows test suite.
Also added code to show how to deal withgitpython-developers#147
1 parentc824bcd commit5d0ad08

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

‎git/test/test_base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,16 @@ def test_add_unicode(self, rw_repo):
118118
file_path=os.path.join(rw_repo.working_dir,filename)
119119
open(file_path,"wb").write(b'something')
120120

121-
rw_repo.git.add(rw_repo.working_dir)
121+
122+
ifos.name=='nt':
123+
# on windows, there is no way this works, see images on
124+
# https://github.com/gitpython-developers/GitPython/issues/147#issuecomment-68881897
125+
# Therefore, it must be added using the python implementation
126+
rw_repo.index.add([file_path])
127+
# However, when the test winds down, rmtree fails to delete this file, which is recognized
128+
# as ??? only.
129+
else:
130+
# on posix, we can just add unicode files without problems
131+
rw_repo.git.add(rw_repo.working_dir)
132+
# end
122133
rw_repo.index.commit('message')

‎git/test/test_git.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,16 @@ def test_version(self):
121121

122122
deftest_cmd_override(self):
123123
prev_cmd=self.git.GIT_PYTHON_GIT_EXECUTABLE
124+
ifos.name=='nt':
125+
exc=GitCommandError
126+
else:
127+
exc=OSError
128+
# end handle windows case
124129
try:
125130
# set it to something that doens't exist, assure it raises
126131
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=os.path.join(
127132
"some","path","which","doesn't","exist","gitbinary")
128-
self.failUnlessRaises(OSError,self.git.version)
133+
self.failUnlessRaises(exc,self.git.version)
129134
finally:
130135
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=prev_cmd
131136
# END undo adjustment

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp