summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-05-11 06:57:33 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-05-11 06:57:33 (GMT)
commit42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3 (patch)
tree27d7ad013999378e92e4a94742831cd2081f5359 /Lib/test/test_bz2.py
parent82be218e971725657af9b3231a0c467e99ade26f (diff)
downloadcpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.zip
cpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.tar.gz
cpython-42dd86b8e2773c342ca7fa0ffcc9d1cbb8589bd3.tar.bz2
Deprecate os.popen* and popen2 module in favor of the subprocess module.
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r--Lib/test/test_bz2.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 709850d..b8b3c03 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -5,7 +5,7 @@ from test.test_support import TESTFN
import unittest
from cStringIO import StringIO
import os
-import popen2
+import subprocess
import sys
import bz2
@@ -21,18 +21,20 @@ class BaseTest(unittest.TestCase):
if has_cmdline_bunzip2:
def decompress(self, data):
- pop = popen2.Popen3("bunzip2", capturestderr=1)
- pop.tochild.write(data)
- pop.tochild.close()
- ret = pop.fromchild.read()
- pop.fromchild.close()
+ pop = subprocess.Popen("bunzip2", shell=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ pop.stdin.write(data)
+ pop.stdin.close()
+ ret = pop.stdout.read()
+ pop.stdout.close()
if pop.wait() != 0:
ret = bz2.decompress(data)
return ret
else:
- # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2
- # isn't available to run.
+ # bunzip2 isn't available to run on Windows.
def decompress(self, data):
return bz2.decompress(data)