summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJonathan Lange <jml@mumak.net>2012-03-27 12:17:37 +0100
committerJonathan Lange <jml@mumak.net>2012-03-27 12:17:37 +0100
commite2cbb8d7bd2fb382ee710a489686fe27ab6cddf2 (patch)
treee7e58d4151c75756e2e9ba6da04b5f39dbbce862 /python
parenta5932aa9f9dcf9593886835adbe6193f0a8a0224 (diff)
downloadsubunit-git-e2cbb8d7bd2fb382ee710a489686fe27ab6cddf2.tar.gz
Factor out subunit-notify
Diffstat (limited to 'python')
-rw-r--r--python/subunit/filters.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
index a221bf7..dc3fd8a 100644
--- a/python/subunit/filters.py
+++ b/python/subunit/filters.py
@@ -98,15 +98,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward,
return result
-def _default_post_run(result):
- if result.wasSuccessful():
- sys.exit(0)
- else:
- sys.exit(1)
-
-
-def run_filter_script(result_factory, description,
- post_run_hook=_default_post_run):
+def run_filter_script(result_factory, description, post_run_hook=None):
"""Main function for simple subunit filter scripts.
Many subunit filter scripts take a stream of subunit input and use a
@@ -125,4 +117,9 @@ def run_filter_script(result_factory, description,
result = filter_by_result(
result_factory, options.output_to, not options.no_passthrough,
options.forward)
- post_run_hook(result)
+ if post_run_hook:
+ post_run_hook(result)
+ if result.wasSuccessful():
+ sys.exit(0)
+ else:
+ sys.exit(1)