summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2012-03-27 11:24:48 +0100
committerJonathan Lange <jml@mumak.net>2012-03-27 11:24:48 +0100
commitb6573405687b85e3132e195e9748555975b1f599 (patch)
tree6f326bb2de36fc484f7976396715f55c28d4048d /python/subunit
parent62e78eeac0762123c478586237cb1448a170e51e (diff)
downloadsubunit-git-b6573405687b85e3132e195e9748555975b1f599.tar.gz
More tweaking of boundaries.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/filters.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
index 9880508..334a95b 100644
--- a/python/subunit/filters.py
+++ b/python/subunit/filters.py
@@ -42,35 +42,38 @@ def get_output_stream(output_to):
return file(output_to, 'wb')
-def filter_with_result(result, no_passthrough, forward):
+def filter_with_result(result_factory, input_stream, output_stream,
+ passthrough_stream, forward_stream):
+ result = result_factory(output_stream)
+ test = ProtocolTestCase(
+ input_stream, passthrough=passthrough_stream,
+ forward=forward_stream)
+ result.startTestRun()
+ test.run(result)
+ result.stopTestRun()
+ return result
+
+
+def something(result_factory, output_path, no_passthrough, forward):
if no_passthrough:
passthrough_stream = DiscardStream()
else:
passthrough_stream = None
+
if forward:
forward_stream = sys.stdout
else:
forward_stream = None
- test = ProtocolTestCase(
- sys.stdin, passthrough=passthrough_stream,
- forward=forward_stream)
- result.startTestRun()
- test.run(result)
- result.stopTestRun()
-
- return result.wasSuccessful()
-
-
-def something(result_factory, output_path, no_passthrough, forward):
output_to = get_output_stream(output_path)
- result = result_factory(output_to)
try:
- successful = filter_with_result(result, no_passthrough, forward)
+ result = filter_with_result(
+ result_factory, sys.stdin, output_to, passthrough_stream,
+ forward_stream)
finally:
if output_path:
output_to.close()
- if successful:
+ if result.wasSuccessful():
return 0
else:
return 1