# HG changeset patch # User Risto Kankkunen # Date 1248877589 -10800 # Node ID 83fcb1cf6d8f56d8856dc535d6f945dc6ce8d4b6 # Parent 37304494cd1530f341588f515a4b5e4c1d445742 Avoid 'ValueError: close_fds is not supported on Windows platforms' exception diff --git a/tests/test_svnwrap.py b/tests/test_svnwrap.py --- a/tests/test_svnwrap.py +++ b/tests/test_svnwrap.py @@ -17,7 +17,8 @@ class TestBasicRepoLayout(unittest.TestC inp = open(os.path.join(os.path.dirname(__file__), 'fixtures', 'project_root_at_repo_root.svndump')) proc = subprocess.call(['svnadmin', 'load', self.repo_path,], - stdin=inp, close_fds=True, + stdin=inp, + close_fds=test_util.canCloseFds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) assert proc == 0 @@ -62,7 +63,8 @@ class TestRootAsSubdirOfRepo(TestBasicRe inp = open(os.path.join(os.path.dirname(__file__), 'fixtures', 'project_root_not_repo_root.svndump')) ret = subprocess.call(['svnadmin', 'load', self.repo_path,], - stdin=inp, close_fds=True, + stdin=inp, + close_fds=test_util.canCloseFds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) assert ret == 0 diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -19,6 +19,13 @@ from mercurial import ui from hgsubversion import util +import sys +# Documentation for Subprocess.Popen() says: +# "Note that on Windows, you cannot set close_fds to true and +# also redirect the standard handles by setting stdin, stdout or +# stderr." +canCloseFds='win32' not in sys.platform + # Fixtures that need to be pulled at a subdirectory of the repo path subdir = {'truncatedhistory.svndump': '/project2', 'fetch_missing_files_subdir.svndump': '/foo',