From d9671e15703918048982c9ff4e2e0fef21ede320 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 5 Nov 2009 20:31:40 +0100 Subject: fixed test_repo to work on windows cmd: taskkill now pipes stderror to nul as well --- lib/git/cmd.py | 2 +- test/git/test_repo.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/git/cmd.py b/lib/git/cmd.py index 6d712ca9..bccfb611 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -71,7 +71,7 @@ class Git(object): # for some reason, providing None for stdout/stderr still prints something. This is why # we simply use the shell and redirect to nul. Its slower than CreateProcess, question # is whether we really want to see all these messages. Its annoying no matter what. - subprocess.call(("TASKKILL /F /T /PID %s > nul" % str(self.proc.pid)), shell=True) + subprocess.call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(self.proc.pid)), shell=True) # END exception handling def __getattr__(self, attr): diff --git a/test/git/test_repo.py b/test/git/test_repo.py index 0b196a1f..93ab7a90 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -7,15 +7,14 @@ import os, sys from test.testlib import * from git import * +from git.utils import join_path_native +import tempfile class TestRepo(TestBase): @raises(InvalidGitRepositoryError) def test_new_should_raise_on_invalid_repo_location(self): - if sys.platform == "win32": - Repo("C:\\WINDOWS\\Temp") - else: - Repo("/tmp") + Repo(tempfile.gettempdir()) @raises(NoSuchPathError) def test_new_should_raise_on_non_existant_path(self): @@ -220,7 +219,8 @@ class TestRepo(TestBase): def test_untracked_files(self): base = self.rorepo.git.git_dir - files = (base+"/__test_myfile", base+"/__test_other_file") + files = ( join_path_native(base, "__test_myfile"), + join_path_native(base, "__test_other_file") ) num_recently_untracked = 0 try: for fpath in files: @@ -233,7 +233,7 @@ class TestRepo(TestBase): # assure we have all names - they are relative to the git-dir num_test_untracked = 0 for utfile in untracked_files: - num_test_untracked += os.path.join(base, utfile) in files + num_test_untracked += join_path_native(base, utfile) in files assert len(files) == num_test_untracked finally: for fpath in files: -- cgit v1.2.3