Commit fa4ab86f authored by Robert Bradshaw's avatar Robert Bradshaw

Python 2.3 fix

parent 112cde8b
...@@ -9,7 +9,6 @@ import shutil ...@@ -9,7 +9,6 @@ import shutil
import unittest import unittest
import doctest import doctest
import operator import operator
import subprocess
import tempfile import tempfile
import traceback import traceback
try: try:
...@@ -731,18 +730,25 @@ class EndToEndTest(unittest.TestCase): ...@@ -731,18 +730,25 @@ class EndToEndTest(unittest.TestCase):
commands = (self.commands commands = (self.commands
.replace("CYTHON", "PYTHON %s" % os.path.join(self.cython_root, 'cython.py')) .replace("CYTHON", "PYTHON %s" % os.path.join(self.cython_root, 'cython.py'))
.replace("PYTHON", sys.executable)) .replace("PYTHON", sys.executable))
old_path = os.environ.get('PYTHONPATH')
try: try:
old_path = os.environ.get('PYTHONPATH')
os.environ['PYTHONPATH'] = os.path.join(self.cython_syspath, (old_path or '')) os.environ['PYTHONPATH'] = os.path.join(self.cython_syspath, (old_path or ''))
p = subprocess.Popen(commands, for command in commands.split('\n'):
stderr=subprocess.PIPE, if sys.version_info[:2] >= (2,4):
stdout=subprocess.PIPE, import subprocess
shell=True) p = subprocess.Popen(commands,
res = p.wait() stderr=subprocess.PIPE,
if res != 0: stdout=subprocess.PIPE,
print p.stdout.read() shell=True)
print p.stderr.read() out, err = p.communicate()
self.assertEqual(0, res) res = p.returncode
if res != 0:
print command
print out
print err
else:
res = os.system(command)
self.assertEqual(0, res, "non-zero exit status")
finally: finally:
if old_path: if old_path:
os.environ['PYTHONPATH'] = old_path os.environ['PYTHONPATH'] = old_path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment