15
15
from unittest import TestCase
16
16
17
17
from git .compat import string_types , is_win
18
- from git .util import rmtree , HIDE_WINDOWS_KNOWN_ERRORS
18
+ from git .util import rmtree
19
19
20
20
import os .path as osp
21
21
@@ -214,7 +214,7 @@ def case(self, rw_repo, rw_remote_repo)
214
214
See working dir info in with_rw_repo
215
215
:note: We attempt to launch our own invocation of git-daemon, which will be shutdown at the end of the test.
216
216
"""
217
- from git import Git , Remote , GitCommandError
217
+ from git import Git , Remote
218
218
219
219
assert isinstance (working_tree_ref , string_types ), "Decorator requires ref name for working tree checkout"
220
220
@@ -273,37 +273,8 @@ def remote_repo_creator(self):
273
273
raise AssertionError (ex , msg )
274
274
# END make assertion
275
275
else :
276
- # try to list remotes to diagnoes whether the server is up
277
- try :
278
- rw_repo .git .ls_remote (d_remote )
279
- except GitCommandError as e :
280
- # We assume in good faith that we didn't start the daemon - but make sure we kill it anyway
281
- # Of course we expect it to work here already, but maybe there are timing constraints
282
- # on some platforms ?
283
- try :
284
- gd .proc .terminate ()
285
- except Exception as ex :
286
- log .debug ("Ignoring %r while terminating proc after %r." , ex , e )
287
- log .warning ('git(%s) ls-remote failed due to:%s' ,
288
- rw_repo .git_dir , e )
289
- if is_win :
290
- msg = textwrap .dedent ("""
291
- MINGW yet has problems with paths, and `git-daemon.exe` must be in PATH
292
- (look into .\Git\mingw64\libexec\git-core\);
293
- CYGWIN has no daemon, but if one exists, it gets along fine (has also paths problems)
294
- Anyhow, alternatively try starting `git-daemon` manually:""" )
295
- else :
296
- msg = "Please try starting `git-daemon` manually:"
297
-
298
- msg += textwrap .dedent ("""
299
- git daemon --enable=receive-pack '%s'
300
- You can also run the daemon on a different port by passing --port=<port>"
301
- and setting the environment variable GIT_PYTHON_TEST_GIT_DAEMON_PORT to <port>
302
- """ % base_path )
303
- from unittest import SkipTest
304
- raise SkipTest (msg ) if HIDE_WINDOWS_KNOWN_ERRORS else AssertionError (e , msg )
305
- # END make assertion
306
- # END catch ls remote error
276
+ # Try listing remotes, to diagnose whether the daemon is up.
277
+ rw_repo .git .ls_remote (d_remote )
307
278
308
279
# adjust working dir
309
280
prev_cwd = os .getcwd ()
@@ -321,6 +292,7 @@ def remote_repo_creator(self):
321
292
322
293
finally :
323
294
try :
295
+ log .debug ("Killing git-daemon..." )
324
296
gd .proc .kill ()
325
297
except :
326
298
## Either it has died (and we're here), or it won't die, again here...
0 commit comments