This article was originally published by Python Magazine in
March of 2008.
Automated Testing with unittest and Proctor
Listing8.py
#!/usr/bin/env python
# Print a list of tests which did not pass.
import fileinput
from proctorlib.result import ResultFactory, TestResult
def show_test_result(test_result):
"Called for each test result parsed from the input data."
if not test_result.passed():
print test_result
return
# Set up the parser
parser = ResultFactory(show_test_result)
# Process data from stdin or files named via sys.argv
for line in fileinput.input():
parser.feed(line)