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
Overhaul exception reporting. #129
Conversation
* ``testtools.run`` now accepts ``--locals`` to show local variables | ||
in tracebacks, which can be a significant aid in debugging. In doing | ||
so we've removed the code reimplementing linecache and traceback as | ||
the traceback2 and linecache2 modules can now be used instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call out the new dependency on traceback2
as a separate bullet point (although, thank heaven that deps aren't quite as much of a pain these days).
Also, nitpick, AIUI, it's not they can be used instead, but rather that we are using them. Is that right?
The pypy3 tests fail:
|
The test failure is not related to this code - note the 0.0000s vs 0.0001s. |
unittest2 recently added the ability to show local variables in tracebacks as testing-cabal#111 requested for us. Reusing that requires some refactoring of our code, in particular where we were reimplementing bits of the traceback module. Now we can just hard-depend on traceback2 and linecache2 which are brought in by unittest2 1.0.0. Change-Id: Ieb3268029d26b48ed4fcd25ed644bd339f6aa3fb
buffer=self.buffer, | ||
stdout=self.stdout, | ||
tb_locals=self.tb_locals) | ||
except TypeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh - this nested try / except is starting to look silly. I guess for now it's OK though. Let's hope we don't find a test runner that accepts 'tb_locals' but not 'verbosity :D
LGTM - can't wait to have locals printed in testtools :D Cheers, |
I'm going to merge this now as it has Thomi's +1 and Jono had no API concerns in his feedback (and I addressed all the please-do-X stuff). |
unittest2 recently added the ability to show local variables in
tracebacks as #111
requested for us. Reusing that requires some refactoring of our code,
in particular where we were reimplementing bits of the traceback
module. Now we can just hard-depend on traceback2 and linecache2 which
are brought in by unittest2 1.0.0.
Change-Id: Ieb3268029d26b48ed4fcd25ed644bd339f6aa3fb