Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit c829adba86b179ae9b6f03ebd91c25f2cdbb6c82 1 parent bad37aa
@toddlipcon toddlipcon authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 test.py
View
11 test.py
@@ -5,6 +5,7 @@
from unittest import TestCase
import os
import subprocess
+import sys
import re
TESTS_DIR=os.path.join(os.getcwd(), "shell-tests")
@@ -12,8 +13,14 @@
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):
Please sign in to comment.
Something went wrong with that request. Please try again.