Browse files

Make test harness slightly nicer - only print output from failing tests

  • Loading branch information...
1 parent bad37aa commit c829adba86b179ae9b6f03ebd91c25f2cdbb6c82 @toddlipcon toddlipcon committed Dec 1, 2009
Showing with 9 additions and 2 deletions.
  1. +9 −2 test.py
View
11 test.py
@@ -5,15 +5,22 @@
from unittest import TestCase
import os
import subprocess
+import sys
import re
TESTS_DIR=os.path.join(os.getcwd(), "shell-tests")
class ShellTests(TestCase):
def _run_shell_test(self, path):
print "running: " + path
- ret = subprocess.call([os.path.join(TESTS_DIR, path)])
- self.assertEquals(ret, 0)
+ p = subprocess.Popen([os.path.join(TESTS_DIR, path)],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ ret = p.wait()
+ if ret != 0:
+ print >>sys.stderr, "Stderr:\n%s\n\nStdout:\n%s\n" % (stderr, stdout)
+ self.fail("Test at %s failed" % path)
def __add_tests():
for x in os.listdir(TESTS_DIR):

0 comments on commit c829adb

Please sign in to comment.