diff options
| author | Robert Collins <robertc@robertcollins.net> | 2013-06-17 07:55:18 +1200 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2013-06-17 07:55:18 +1200 |
| commit | 5d6d7a08690513ea28b1e1087aaa574f8d541916 (patch) | |
| tree | 4386bc9934bde0beec23ca41211e4848f520d60a /python | |
| parent | 80e10ab3041518098f0d298fec214696f3d86fef (diff) | |
| download | subunit-git-5d6d7a08690513ea28b1e1087aaa574f8d541916.tar.gz | |
* `subunit-stats` no longer outputs encapsulated stdout as subunit.
(Robert Collins, #1171987)
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/filters.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py index 08ea136..5ad3c53 100644 --- a/python/subunit/filters.py +++ b/python/subunit/filters.py @@ -106,7 +106,8 @@ def run_tests_from_stream(input_stream, result, passthrough_stream=None, def filter_by_result(result_factory, output_path, passthrough, forward, - input_stream=sys.stdin, protocol_version=1): + input_stream=sys.stdin, protocol_version=1, + passthrough_subunit=True): """Filter an input stream using a test result. :param result_factory: A callable that when passed an output stream @@ -121,6 +122,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward, :param input_stream: The source of subunit input. Defaults to ``sys.stdin``. :param protocol_version: The subunit protocol version to expect. + :param passthrough_subunit: If True, passthrough should be as subunit. :return: A test result with the results of the run. """ if passthrough: @@ -147,7 +149,8 @@ def filter_by_result(result_factory, output_path, passthrough, forward, result = result_factory(output_to) run_tests_from_stream( input_stream, result, passthrough_stream, forward_stream, - protocol_version=protocol_version) + protocol_version=protocol_version, + passthrough_subunit=passthrough_subunit) finally: if output_path: output_to.close() @@ -155,7 +158,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward, def run_filter_script(result_factory, description, post_run_hook=None, - protocol_version=1): + protocol_version=1, passthrough_subunit=True): """Main function for simple subunit filter scripts. Many subunit filter scripts take a stream of subunit input and use a @@ -169,12 +172,14 @@ def run_filter_script(result_factory, description, post_run_hook=None, a test result that outputs to that stream. :param description: A description of the filter script. :param protocol_version: What protocol version to consume/emit. + :param passthrough_subunit: If True, passthrough should be as subunit. """ parser = make_options(description) (options, args) = parser.parse_args() result = filter_by_result( result_factory, options.output_to, not options.no_passthrough, - options.forward, protocol_version=protocol_version) + options.forward, protocol_version=protocol_version, + passthrough_subunit=passthrough_subunit) if post_run_hook: post_run_hook(result) if not safe_hasattr(result, 'wasSuccessful'): |
