There are no shell bindings for subunit v2 streams

Bug #1252084 reported by Thomi Richards
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subunit
Fix Released
High
Unassigned

Bug Description

We'd like to be able to generate a subunit result stream from a shell script by calling a 'subunit' executable.

I propose adding a 'subunit-output' ython script. The intended usage would be like this:

# Tell subunit that we're starting a test called 'test.name'
subunit-output start test.name

# Tell subunit that the 'test.name' test passed:
subunit-output pass test.name

# similarly, fail 'test.name':
subunit-output fail test.name

We also want to support attaching testtools content objects to the result stream. I propose:

# Attach a detail containing a short text string to the test result, with a label of 'some.data'
subunit-output attach-text "some.data" "some text goes here"

# Attach a detail containing file:
subunit-attach attach-file "screenshot-01" /path/to/some/file.png

Implementation
==============

It looks like I can instantiate a subunit.v2.StreamResultToBytes and call 'status' with values of 'inprogress', 'passed', 'failed' etc to start, pass and fail the tests, as well as attaching details.

I think this should be a single python file named 'filters/subunit-output' (it's not really a filter, but that's where all the other scripts are). This file would just contain "from subunit import output_main; output_main()'.

Testing
======

There's not a lot to test here:
 * The command line parser works as expected (i.e.- raises helpful error messages when the wrong number of parameters are given, for e.g.)
 * Some system tests that call the filter executable with various parameters and ensure that the resulting output can be read in by the subunit module, and the results are all as expected.

Happy to get feedback on this before I start hacking!

Related branches

Changed in subunit:
assignee: nobody → Thomi Richards (thomir)
Revision history for this message
Robert Collins (lifeless) wrote :

So this sounds broadly fine.

A few constraints:
 - must not emit anything on stdout other than the requested packet
 - should export all the functionality of StreamResultToBytes (though not necessarily in one landing)

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Ack on those constraints.

summary: - Add script to generate subunit result stream from the command line
+ There are no shell bindings for subunit v2 streams
Changed in subunit:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

FWIW this is a requirement for Samba moving over to subunitv2 as well.

Changed in subunit:
status: Triaged → In Progress
Changed in subunit:
status: In Progress → Fix Committed
Changed in subunit:
milestone: none → 0.0.17
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.