diff options
| author | Jonathan Lange <jml@mumak.net> | 2012-03-27 11:57:51 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2012-03-27 11:57:51 +0100 |
| commit | 2bf7d82ce68dc62bf6d05bbbd0a213dc3393f9b7 (patch) | |
| tree | e439d4f15328600d0acdc445a7546d7962fb069b /python/subunit | |
| parent | efa4dc4ef3965c2b9b8d9867e9a80def71e452cd (diff) | |
| download | subunit-git-2bf7d82ce68dc62bf6d05bbbd0a213dc3393f9b7.tar.gz | |
Rename main() and give it a docstring.
Diffstat (limited to 'python/subunit')
| -rw-r--r-- | python/subunit/filters.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py index 0bab9ed..f8ce2dd 100644 --- a/python/subunit/filters.py +++ b/python/subunit/filters.py @@ -18,7 +18,6 @@ from optparse import OptionParser import sys from subunit import DiscardStream, ProtocolTestCase -from subunit.test_results import CsvResult def make_options(description): @@ -106,7 +105,20 @@ def filter_by_result(result_factory, output_path, no_passthrough, forward, return 1 -def main(result_factory, description): +def run_filter_script(result_factory, description): + """Main function for simple subunit filter scripts. + + Many subunit filter scripts take a stream of subunit input and use a + TestResult to handle the events generated by that stream. This function + wraps a lot of the boiler-plate around that by making a script with + options for handling passthrough information and stream forwarding, and + that will exit with a successful return code (i.e. 0) if the input stream + represents a successful test run. + + :param result_factory: A callable that takes an output stream and returns + a test result that outputs to that stream. + :param description: A description of the filter script. + """ parser = make_options(description) (options, args) = parser.parse_args() sys.exit( |
