summaryrefslogtreecommitdiff
path: root/git/test
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-09-26 19:42:42 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-09-26 20:54:12 +0200
commit45f8f20bdf1447fbfebd19a07412d337626ed6b0 (patch)
treedfd959548fb72122df7358c062a32bcff3acf4a1 /git/test
parent783ad99b92faa68c5cc2550c489ceb143a93e54f (diff)
downloadgitpython-45f8f20bdf1447fbfebd19a07412d337626ed6b0.tar.gz
Win, #519: FIX WinHangs: Popen() CREATE_NEW_PROCESS_GROUP to allow kill
+ FIXED most hangs BUT no more `git-daemon` un-killable! + Use logger for utils to replace stray print().
Diffstat (limited to 'git/test')
-rw-r--r--git/test/lib/helper.py12
-rw-r--r--git/test/test_git.py5
2 files changed, 10 insertions, 7 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 9488005f..b59f518b 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -5,12 +5,12 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from __future__ import print_function
import os
-import sys
from unittest import TestCase
import time
import tempfile
import shutil
import io
+import logging
from git import Repo, Remote, GitCommandError, Git
from git.compat import string_types
@@ -25,6 +25,8 @@ __all__ = (
'with_rw_repo', 'with_rw_and_rw_remote_repo', 'TestBase', 'TestCase', 'GIT_REPO', 'GIT_DAEMON_PORT'
)
+log = logging.getLogger('git.util')
+
#{ Routines
@@ -120,7 +122,7 @@ def with_rw_repo(working_tree_ref, bare=False):
try:
return func(self, rw_repo)
except:
- print("Keeping repo after failure: %s" % repo_dir, file=sys.stderr)
+ log.info("Keeping repo after failure: %s", repo_dir)
repo_dir = None
raise
finally:
@@ -218,7 +220,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
# on some platforms ?
if gd is not None:
os.kill(gd.proc.pid, 15)
- print(str(e))
+ log.warning('git-ls-remote failed due to: %s(%s)', type(e), e)
if os.name == 'nt':
msg = "git-daemon needs to run this test, but windows does not have one. "
msg += 'Otherwise, run: git-daemon "%s"' % temp_dir
@@ -239,8 +241,8 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
try:
return func(self, rw_repo, rw_remote_repo)
except:
- print("Keeping repos after failure: repo_dir = %s, remote_repo_dir = %s"
- % (repo_dir, remote_repo_dir), file=sys.stderr)
+ log.info("Keeping repos after failure: repo_dir = %s, remote_repo_dir = %s",
+ repo_dir, remote_repo_dir)
repo_dir = remote_repo_dir = None
raise
finally:
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 935673b1..ea62de03 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -21,7 +21,8 @@ from git import (
Git,
GitCommandError,
GitCommandNotFound,
- Repo
+ Repo,
+ cmd
)
from gitdb.test.lib import with_rw_directory
@@ -240,7 +241,7 @@ class TestGit(TestBase):
stderr=subprocess.PIPE,
shell=False,
universal_newlines=True,
- creationflags=Git.CREATE_NO_WINDOW if sys.platform == 'win32' else 0,
+ creationflags=cmd.PROC_CREATIONFLAGS,
)
handle_process_output(proc, counter_stdout, counter_stderr, lambda proc: proc.wait())