Merge lp:~pwlars/checkbox/fix-unicode-result-history into lp:checkbox

Proposed by Paul Larson
Status: Merged
Approved by: Pierre Equoy
Approved revision: 4439
Merged at revision: 4439
Proposed branch: lp:~pwlars/checkbox/fix-unicode-result-history
Merge into: lp:checkbox
Diff against target: 9 lines (+1/-1)
1 file modified
plainbox/plainbox/impl/exporter/text.py (+1/-1)
To merge this branch: bzr merge lp:~pwlars/checkbox/fix-unicode-result-history
Reviewer Review Type Date Requested Status
Pierre Equoy Approve
Review via email: mp+300120@code.launchpad.net

Description of the change

I was getting an error [1] trying to run over ssh with the checkbox snap on rpi2. This seems to correct things for me, but it's strange, because the unicode it refers to is the checked box char I think. But I don't see that anywhere in the output. I also did a sanity check with plainbox self-test -u and it passed everything there too.

[1]
Count: 0
Undeclared exception UnicodeEncodeError raised from export_to_transport
------------------------------------------------------------------------- >8 ---
Outcome: job failed
History:
                        Application Malfunction Detected

Traceback (most recent call last):
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/guacamole/core.py", line 248, in eat
    return self._dispatch()
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/guacamole/core.py", line 298, in _dispatch
    result = ingredient.dispatch(self.context)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/guacamole/ingredients/cmdtree.py", line 152, in dispatch
    return self._dispatch(context, 0)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/guacamole/ingredients/cmdtree.py", line 165, in _dispatch
    retval = command.invoked(context)
  File "/snap/checkbox-snappy/x1/usr/bin/checkbox-cli", line 232, in invoked
    self._export_results()
  File "/snap/checkbox-snappy/x1/usr/bin/checkbox-cli", line 771, in _export_results
    exporter_id, transport)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/plainbox/impl/decorators.py", line 104, in wrapper
    raise exc
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/plainbox/impl/decorators.py", line 98, in wrapper
    return func(*args, **kwargs)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/plainbox/impl/session/assistant.py", line 1399, in export_to_transport
    exporter.dump_from_session_manager(self._manager, exported_stream)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/plainbox/impl/exporter/__init__.py", line 194, in dump_from_session_manager
    self.dump(self.get_session_data_subset(session_manager), stream)
  File "/snap/checkbox-snappy/x1/usr/lib/python3/dist-packages/plainbox/impl/exporter/text.py", line 77, in dump
    for result in state.result_history))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2611' in position 0: ordinal not in range(128)

  Please report a bug including the information from the paragraph above. To
  report the bug visit https://bugs.launchpad.net/checkbox-ng/+filebug

  We are sorry for the inconvenience!

To post a comment you must log in.
Revision history for this message
Pierre Equoy (pieq) wrote :

+1

I don't know why the utf-8 encoding was missing in this very last case! Thanks for finding this out Paul!

We use this "\u2611" checkbox (☑) when printing out the text summary at the end of a session for all the jobs that passed (or, if they were run several times, for the time they passed).

Not sure why you don't see that in your output, but it should be here :)

(I just tested on a TTY on my computer — Ctrl+Alt+F1 — and it doesn't display unicode boxes but colored diamonds instead... but I think I'm in another situation, with colors available but ASCII only)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox/plainbox/impl/exporter/text.py'
2--- plainbox/plainbox/impl/exporter/text.py 2015-06-25 11:52:05 +0000
3+++ plainbox/plainbox/impl/exporter/text.py 2016-07-14 19:26:54 +0000
4@@ -74,4 +74,4 @@
5 self.C.custom(
6 result.outcome_meta().unicode_sigil,
7 result.outcome_meta().color_ansi)
8- for result in state.result_history))
9+ for result in state.result_history).encode("UTF-8"))

Subscribers

People subscribed via source and target branches