Opened 16 years ago

Closed 16 years ago

Last modified 6 years ago

#1855 defect closed fixed (fixed)

trial pyunit support mixes up argument order when creating Failures

Reported by: Jean-Paul Calderone Owned by:
Priority: high Milestone:
Component: trial Keywords:
Cc: Jean-Paul Calderone Branch:
Author:

Description

pyunit does this:

result.addError(self, self.__exc_info())

which trial translates into

    def addError(self, test, error):
        """Report an error that occurred while running the given test.

        @type test: L{pyunit.TestCase}
        @type fail: L{failure.Failure} or L{tuple}
        """
        if isinstance(error, tuple):
            error = failure.Failure(*error)
        self.errors.append((test, error))

but Failure.init is defined like

    def __init__(self, exc_value=None, exc_type=None, exc_tb=None):

exc_value and exc_type are flipped.

Change History (6)

comment:1 Changed 16 years ago by Jonathan Lange

Well spotted!

comment:2 Changed 16 years ago by Jonathan Lange

Status: newassigned

comment:3 Changed 16 years ago by Jonathan Lange

Keywords: review added
Owner: changed from Jonathan Lange to Jean-Paul Calderone
Status: assignednew

source:branches/exception-order-1855

Thanks.

comment:4 Changed 16 years ago by Jonathan Lange

Resolution: fixed
Status: newclosed

(In [17376]) Fix TestResult to correctly handle errors in pyunit TestCases

  • Author: jml
  • Review: exarkun
  • Fixes #1855

addError and addFailure were naively passing the exc_info tuple straight to the Failure constructor. I've added tests which demonstrate the problem and fixed addError and addFailure to flip the order of the tuple.

comment:5 Changed 11 years ago by <automation>

Owner: Jean-Paul Calderone deleted

comment:6 Changed 6 years ago by hawkowl

Keywords: review removed

[mass edit] Removing review from closed tickets.

Note: See TracTickets for help on using tickets.