Mercurial > hgsubversion
diff svnwrap/tests/test_svnwrap.py @ 309:9ad5cf45e30c
svnwrap/tests: use the subprocess module rather than the popen module.
The output from the command is supressed. Use check_call() to ensure
the detection of failures.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sun, 03 May 2009 18:25:48 +0200 |
parents | bfbce70a9a57 |
children | 4f4db3d2fdbb |
line wrap: on
line diff
--- a/svnwrap/tests/test_svnwrap.py +++ b/svnwrap/tests/test_svnwrap.py @@ -1,5 +1,5 @@ import os -import popen2 +import subprocess import shutil import tempfile import unittest @@ -14,12 +14,12 @@ class TestBasicRepoLayout(unittest.TestC self.repo_path = '%s/testrepo' % self.tmpdir os.spawnvp(os.P_WAIT, 'svnadmin', ['svnadmin', 'create', self.repo_path,]) - proc = popen2.Popen4(['svnadmin', 'load', self.repo_path,]) inp = open(os.path.join(os.path.dirname(__file__), 'fixtures', 'project_root_at_repo_root.svndump')) - proc.tochild.write(inp.read()) - proc.tochild.close() - proc.wait() + proc = subprocess.check_call(['svnadmin', 'load', self.repo_path,], + stdin=inp, close_fds=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) self.repo = svnwrap.SubversionRepo('file://%s' % self.repo_path) def tearDown(self): @@ -59,11 +59,11 @@ class TestRootAsSubdirOfRepo(TestBasicRe self.repo_path = '%s/testrepo' % self.tmpdir os.spawnvp(os.P_WAIT, 'svnadmin', ['svnadmin', 'create', self.repo_path,]) - proc = popen2.Popen4(['svnadmin', 'load', self.repo_path,]) inp = open(os.path.join(os.path.dirname(__file__), 'fixtures', 'project_root_not_repo_root.svndump')) - proc.tochild.write(inp.read()) - proc.tochild.close() - proc.wait() + subprocess.check_call(['svnadmin', 'load', self.repo_path,], + stdin=inp, close_fds=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) self.repo = svnwrap.SubversionRepo('file://%s/dummyproj' % self.repo_path)