summaryrefslogtreecommitdiff
path: root/python/subunit/_output.py
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-11-19 11:16:41 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-11-19 11:16:41 +1300
commit03b5ef473ebf841b6187f2423eaa5c97f36885fb (patch)
tree91fb4e9a4cadcccf0dd0478deabe80da47e9075f /python/subunit/_output.py
parent8782262d7d0750beb6111b8197865343fe0a8637 (diff)
downloadsubunit-git-03b5ef473ebf841b6187f2423eaa5c97f36885fb.tar.gz
Add support for passing mime-type on the command-line.
Diffstat (limited to 'python/subunit/_output.py')
-rw-r--r--python/subunit/_output.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/python/subunit/_output.py b/python/subunit/_output.py
index b4df54c..4bd93d1 100644
--- a/python/subunit/_output.py
+++ b/python/subunit/_output.py
@@ -52,6 +52,13 @@ def parse_arguments(args=None, ParserClass=ArgumentParser):
type=file,
help="Attach a file to the result stream for this test."
)
+ common_args.add_argument(
+ "--mimetype",
+ help="The mime type to send with this file. This is only used if the "\
+ "--attach-file argument is used. This argument is optional. If it is "\
+ "not specified, the file will be sent wihtout a mime type.",
+ default=None
+ )
sub_parsers = parser.add_subparsers(dest="action")
final_state = "This is a final action: No more actions may be generated " \
@@ -108,7 +115,12 @@ def get_output_stream_writer():
def generate_bytestream(args, output_writer):
output_writer.startTestRun()
if args.attach_file:
- write_chunked_file(args.attach_file, args.test_id, output_writer)
+ write_chunked_file(
+ args.attach_file,
+ args.test_id,
+ output_writer,
+ args.mimetype,
+ )
output_writer.status(
test_id=args.test_id,
test_status=translate_command_name(args.action),