Ticket #2495 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

Trial never passes a traceback to pyunit-API TestResult objects

Reported by: jml Owned by: jml
Priority: highest Milestone:
Component: trial Keywords:
Cc: itamarst Branch:
Author: Launchpad Bug:

Description

If one is using the pyunit.TestResult object, or the zope testrunnner TestResult object, one never, ever receives a traceback from Trial TestCases.

Extremely frustrating bug.

Change History

Changed 4 years ago by jml

  • keywords review added
  • priority changed from high to highest
  • owner changed from jml to spiv

Ready for review in pyresult-tb-2495.

Changed 4 years ago by jml

  • priority changed from highest to high
  • keywords review removed
  • owner changed from spiv to jml

Taking down from review and adding traceback simulation feature.

Changed 4 years ago by jml

  • owner changed from jml to spiv
  • keywords review added
  • priority changed from high to highest

Ready for review in same branch.

Changed 4 years ago by itamarst

  • cc itamarst added

What is the relation of this branch re the fixes proposed for #2466?

Changed 4 years ago by jml

This branch makes no changes to the handling of locals or globals. The only new attribute it introduces is a method.

Changing the handling of locals or globals probably wouldn't affect the branch.

Changed 4 years ago by exarkun

  • keywords review removed
  • owner changed from spiv to jml

FormattableTraceback, Code, and Frame are missing docstrings and attribute documentation. I'm not sure FormattableTraceback makes a lot of sense (if it does, why not FormattableCode and FormattableFrame?)

getFormattableTraceback's docstring is misformated. I'm also not sure what it's behavior in the case of Failure(Exception("foo")) is meant to be.

In test_getFormattableTraceback, assertEqual should be assertIdentical, shouldn't it be?

TestFormattableTraceback is missing docstrings.

ErrorTest defined in test_traceback gratuitously uses s instead of self.

Also, should the todo on test_traceback be there? The test passes, and so does the referenced precondition.

Changed 3 years ago by jml

  • status changed from new to closed
  • resolution set to fixed

(In [19771]) Useful tracebacks when running Trial tests against pyunit TestResults

  • Author: jml
  • Reviewer: exarkun
  • Fixes #2495

Adds a new method getTracebackObject to Failure, which always returns an object that can be passed to traceback.extract_tb and includes all the information the Failure has on the relevant stack trace.

Uses this new method to provide sys.exc_info-like information to pyunit TestResult objects via PyUnitResultAdapter.

Note: See TracTickets for help on using tickets.