import unittest
import doctest
import operator
+import subprocess
import tempfile
import traceback
try:
def setUp(self):
from Cython.TestUtils import unpack_source_tree
- _, self.commands = unpack_source_tree(os.path.join('tests', 'build', self.treefile), self.workdir)
+ _, self.commands = unpack_source_tree(
+ os.path.join('tests', 'build', self.treefile), self.workdir)
self.old_dir = os.getcwd()
os.chdir(self.workdir)
if self.workdir not in sys.path:
.replace("PYTHON", sys.executable))
old_path = os.environ.get('PYTHONPATH')
try:
- os.environ['PYTHONPATH'] = self.cython_syspath + os.pathsep + (old_path or '')
- print(os.environ['PYTHONPATH'])
- self.assertEqual(0, os.system(commands))
+ os.environ['PYTHONPATH'] = os.path.join(self.cython_syspath, (old_path or ''))
+ p = subprocess.Popen(commands,
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ shell=True)
+ res = p.wait()
+ if res != 0:
+ print p.stdout.read()
+ print p.stderr.read()
+ self.assertEqual(0, res)
finally:
if old_path:
os.environ['PYTHONPATH'] = old_path