diff options
| author | Jonathan Lange <jml@mumak.net> | 2012-03-27 11:32:03 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@mumak.net> | 2012-03-27 11:32:03 +0100 |
| commit | 60ad2fb938fd2d899258c80b56879e189e3c4d5c (patch) | |
| tree | 3126c628dc104dfe2a17b37afd564b97d026ea1c /python | |
| parent | b6573405687b85e3132e195e9748555975b1f599 (diff) | |
| download | subunit-git-60ad2fb938fd2d899258c80b56879e189e3c4d5c.tar.gz | |
More fiddling about.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/filters.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/python/subunit/filters.py b/python/subunit/filters.py index 334a95b..14486a0 100644 --- a/python/subunit/filters.py +++ b/python/subunit/filters.py @@ -35,13 +35,6 @@ def make_options(): return parser -def get_output_stream(output_to): - if output_to is None: - return sys.stdout - else: - return file(output_to, 'wb') - - def filter_with_result(result_factory, input_stream, output_stream, passthrough_stream, forward_stream): result = result_factory(output_stream) @@ -65,7 +58,11 @@ def something(result_factory, output_path, no_passthrough, forward): else: forward_stream = None - output_to = get_output_stream(output_path) + if output_path is None: + output_to = sys.stdout + else: + output_to = file(output_path, 'wb') + try: result = filter_with_result( result_factory, sys.stdin, output_to, passthrough_stream, @@ -79,8 +76,9 @@ def something(result_factory, output_path, no_passthrough, forward): return 1 -def main(): +def main(result_factory): parser = make_options() (options, args) = parser.parse_args() sys.exit( - something(CsvResult, options.output_to, options.no_passthrough, options.forward)) + something(CsvResult, options.output_to, options.no_passthrough, + options.forward)) |
