# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1241367948 -7200 # Node ID 9ad5cf45e30c60d352fc7ef17d0e5ca244d9f2b8 # Parent 41aa4c3f789ef76120eed3dacbf4ac42c93f2139 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. diff --git a/svnwrap/tests/test_svnwrap.py b/svnwrap/tests/test_svnwrap.py --- 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)