Opened 4 years ago

Closed 4 years ago

#6377 enhancement closed fixed (fixed)

print traceback in successResultOf error reporting

Reported by: Ying Li Owned by: Ying Li
Priority: normal Milestone:
Component: core Keywords: easy
Cc: Branch: branches/successResultOf-traceback-6377
branch-diff, diff-cov, branch-cov, buildbot
Author: cyli

Description

It currently prints the repr of the Failure, it'd be nice to be able to find out where the Failure occurred.

Also, would be nice to be able to pass optional errors to failureResultOf to check which errors are supposed to have been raised similar to (like assertRaises)

Change History (11)

comment:1 Changed 4 years ago by Ying Li

Author: cyli
Branch: branches/successResultOf-traceback-6377

(In [37591]) Branching to 'successResultOf-traceback-6377'

comment:2 Changed 4 years ago by Ying Li

(In [37598]) Add an optional expected exception type to failureResultOf. refs #6377

comment:3 Changed 4 years ago by Ying Li

Forgot to include a refs tag in the commit message in the previous commit:

(In r37595) Include traceback in successResultOf error reporting

comment:4 Changed 4 years ago by Ying Li

(In [37599]) Add topfile. refs #6377

comment:5 Changed 4 years ago by Ying Li

Owner: Ying Li deleted

build results

The failure thing might be out of scope and perhaps should be broken into a different ticket, but these are pretty tiny changes.

comment:6 Changed 4 years ago by Ying Li

Keywords: easy review added

comment:7 Changed 4 years ago by Tom Prince

Keywords: review removed
Owner: set to Ying Li
  • successResultOf and failureResultOf are supported on python 3, so additional behaviour for them should be tested, and tested succesfully.
  • I'd be inclined so say that failureResultOf should take a list of exception types, like Failure.trap, Failure.check, TestCase.assertFailure. (This would incidentally allow you to simply pass the list to Failure.check, rather than 'if x and f.check(x):`.
  • The news item would read better as two seperate news items, which suggests that this should be two tickets.

comment:8 Changed 4 years ago by Ying Li

(In [37616]) Move failureResultOf changes to a different ticket, and fix python3 tests. refs #6377

comment:9 Changed 4 years ago by Ying Li

Keywords: review added
Owner: Ying Li deleted

Thanks for the quick review tom.prince!

  1. Hm... ok, I'm now testing to see if the traceback is in the str of the exception, since in Python 3 exceptions don't necessarily have a .message attribute anymore.
  2. I've split the failureResultOf stuff into #6380.
  3. Changed the newsfile to a .misc instead.

buildbot results

comment:10 Changed 4 years ago by Tom Prince

Keywords: review removed
Owner: set to Ying Li

Looks good, please merge.

comment:11 Changed 4 years ago by Ying Li

Resolution: fixed
Status: newclosed

(In [37828]) Merge successResultOf-traceback-6377: more useful traceback if failure

Author: cyli Reviewer: tom.prince Fixes: #6377

If the Deferred provided to successResultOf errbacks, print a traceback instead of just the repr of the failure.

Note: See TracTickets for help on using tickets.