subunit2junitxml fails to output subunit stream

Bug #1320053 reported by Thomi Richards
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyjunitxml
Triaged
High
Unassigned

Bug Description

We occaisonally encounter a problem with subunit2junitxml.

When we run our tests, we create a subunit (v2) result file, and then later run:

$ cat test_results.subunit | subunit2junitxml > test_results.xml

Most of the time this works fine, but occaisonally it crashes with the following stack trace:

Traceback (most recent call last):
  File "/usr/bin/subunit2junitxml", line 36, in <module>
    protocol_version=2)
  File "/usr/lib/python3/dist-packages/subunit/filters.py", line 177, in run_filter_script
    options.forward, protocol_version=protocol_version)
  File "/usr/lib/python3/dist-packages/subunit/filters.py", line 150, in filter_by_result
    protocol_version=protocol_version)
  File "/usr/lib/python3/dist-packages/subunit/filters.py", line 105, in run_tests_from_stream
    result.stopTestRun()
  File "/usr/lib/python3/dist-packages/testtools/testresult/real.py", line 491, in stopTestRun
    sink.stopTestRun()
  File "/usr/lib/python3/dist-packages/testtools/testresult/real.py", line 1449, in stopTestRun
    self.decorated.stopTestRun()
  File "/usr/lib/python3/dist-packages/testtools/testresult/real.py", line 1265, in stopTestRun
    return self.decorated.stopTestRun()
  File "/usr/lib/python3/dist-packages/junitxml/__init__.py", line 169, in stopTestRun
    self._stream.write(''.join(self._results))
UnicodeEncodeError: 'ascii' codec can't encode character '\xa2' in position 3062: ordinal not in range(128)

The subunit file responsible for that crash is attached to the bug report, but I'm unable to reproduce the crash locally.

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

The error is in transcoding - which we should be avoiding // not triggering

affects: subunit → pyjunitxml
Changed in pyjunitxml:
status: New → Triaged
importance: Undecided → High
summary: - subunit2junitxml fails to parse subunit stream
+ subunit2junitxml fails to output subunit stream
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.