summaryrefslogtreecommitdiff
path: root/test/test_farm.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-07-08 14:05:36 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-07-08 14:05:36 -0400
commit9c7324f1e57909a83d145ee6d0826c8cf7d1a62e (patch)
tree383732694af2d44bb08f13ed524827e7a0d38c79 /test/test_farm.py
parentcf8104fc6f89f930c9ed73aa5fcb26d719c34c8c (diff)
downloadpython-coveragepy-9c7324f1e57909a83d145ee6d0826c8cf7d1a62e.tar.gz
Py3k: unify subprocess and popen4.
Diffstat (limited to 'test/test_farm.py')
-rw-r--r--test/test_farm.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/test/test_farm.py b/test/test_farm.py
index d33dcdc..4323f23 100644
--- a/test/test_farm.py
+++ b/test/test_farm.py
@@ -1,11 +1,7 @@
"""Run tests in the farm subdirectory. Designed for nose."""
import filecmp, fnmatch, glob, os, shutil, sys
-
-try:
- import subprocess
-except ImportError:
- subprocess = None
+from coverage.backward import run_command
def test_farm(clean_only=False):
@@ -135,16 +131,7 @@ class FarmTestCase(object):
for cmd in cmds.split("\n"):
if not cmd.strip():
continue
- if subprocess:
- proc = subprocess.Popen(cmd, shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- retcode = proc.wait()
- output = proc.stdout.read()
- else:
- _, stdouterr = os.popen4(cmd)
- output = stdouterr.read()
- retcode = 0 # Can't tell if the process failed.
+ retcode, output = run_command(cmd)
print output,
if outfile:
open(outfile, "a+").write(output)