diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2013-11-19 15:28:28 +1300 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2013-11-19 15:28:28 +1300 |
| commit | 8eb109578e86a1e432b4a29081c610cfdbac4b82 (patch) | |
| tree | 33a68396ec2cdd20d0df29cc2b40d622e62054f8 /python/subunit/_output.py | |
| parent | 4d3f98360afb4c5f1677bd50a9f7eefb2e3b570b (diff) | |
| download | subunit-git-8eb109578e86a1e432b4a29081c610cfdbac4b82.tar.gz | |
Python 3 compatibility fixes.
Diffstat (limited to 'python/subunit/_output.py')
| -rw-r--r-- | python/subunit/_output.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/python/subunit/_output.py b/python/subunit/_output.py index b3ab675..dd81b87 100644 --- a/python/subunit/_output.py +++ b/python/subunit/_output.py @@ -17,7 +17,7 @@ from argparse import ArgumentParser import datetime from functools import partial from sys import stdout -from string import split +from testtools.compat import _b from subunit.v2 import StreamResultToBytes @@ -55,7 +55,7 @@ def parse_arguments(args=None, ParserClass=ArgumentParser): ) common_args.add_argument( "--attach-file", - type=file, + type=open, help="Attach a file to the result stream for this test." ) common_args.add_argument( @@ -68,7 +68,7 @@ def parse_arguments(args=None, ParserClass=ArgumentParser): common_args.add_argument( "--tags", help="A comma-separated list of tags to associate with this test.", - type=partial(split, sep=','), + type=lambda s: s.split(','), default=None ) sub_parsers = parser.add_subparsers( @@ -165,7 +165,7 @@ def generate_bytestream(args, output_writer): def write_chunked_file(file_obj, test_id, output_writer, chunk_size=1024, mime_type=None): reader = partial(file_obj.read, chunk_size) - for chunk in iter(reader, ''): + for chunk in iter(reader, _b('')): output_writer.status( test_id=test_id, file_name=file_obj.name, @@ -176,7 +176,7 @@ def write_chunked_file(file_obj, test_id, output_writer, chunk_size=1024, output_writer.status( test_id=test_id, file_name=file_obj.name, - file_bytes='', + file_bytes=_b(''), mime_type=mime_type, eof=True, ) |
