Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be compatible with eliot-tree 17.0.0 & Twisted >= 17.1.0 #101

Open
exarkun opened this issue Feb 28, 2017 · 2 comments
Open

Be compatible with eliot-tree 17.0.0 & Twisted >= 17.1.0 #101

exarkun opened this issue Feb 28, 2017 · 2 comments

Comments

@exarkun
Copy link
Contributor

exarkun commented Feb 28, 2017

Something unicode-y happened and eliot trees now get rendered uglyfuly in the testtools details output.

@exarkun
Copy link
Contributor Author

exarkun commented Mar 1, 2017

As I understand it:

  • eliottree started including some non-ascii in the tree whereas previously the tree was entirely ascii
  • the eliottree becomes a text/utf Content detail of a Fixture
  • testtools gathers the Content and creates a _StringException with its as_text
  • testtools tries to add that _StringException as an error to the test result
  • the test result is a twisted.trial.reporter.TreeReporter
  • TreeReporter inherits addError from twisted.trial.reporter.Reporter
  • Reporter.addError creates a Failure from the _StringException
  • The Failures are all reported using Reporter._formatFailureTraceback
  • _formatFailureTraceback calls Failure.getTraceback
  • ... which calls Failure.printTraceback
  • ... which eventually calls reflect.safe_str(self.value) to format the exception into the traceback
  • safe_str does unicode(value).encode('ascii', 'backslashreplace') which smashes eliottree's nice unicode drawing characters into ugly useless unicode escapes.

@exarkun
Copy link
Contributor Author

exarkun commented Mar 1, 2017

It turns out this is also related to Twisted 17.1 (or perhaps originally 16.6) in which the backslashreplace encoding was added to safe_str.

@exarkun exarkun changed the title Be compatible with eliot-tree 17.0.0 Be compatible with eliot-tree 17.0.0 & Twisted >= 17.1.0 Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant