changeset 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 41aa4c3f789e
children 15b8bab03504
files svnwrap/tests/test_svnwrap.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
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)