hide output in end-to-end tests
authorRobert Bradshaw <robertwb@math.washington.edu>
Sun, 5 Dec 2010 06:55:17 +0000 (22:55 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sun, 5 Dec 2010 06:55:17 +0000 (22:55 -0800)
runtests.py

index 8d9664524e6f9222a8889db908e8b78fa7eb4d7b..c5961b1bfedd537001bd86041b957887a2cf42a7 100644 (file)
@@ -9,6 +9,7 @@ import shutil
 import unittest
 import doctest
 import operator
+import subprocess
 import tempfile
 import traceback
 try:
@@ -714,7 +715,8 @@ class EndToEndTest(unittest.TestCase):
 
     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:
@@ -731,9 +733,16 @@ class EndToEndTest(unittest.TestCase):
             .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