From 58e0301f87e3829c21e9aa9170c9c929cce70fe9 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 18 Nov 2011 16:34:46 +0000 Subject: [PATCH] fix compat with testcases from trial-11.1.0 --- CHANGELOG | 1 + _pytest/unittest.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 72c652126..848d020fb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,7 @@ Changes between 2.1.3 and XXX 2.2.0 - fix and cleanup pytest's own test suite to not leak FDs - fix issue83: link to generated funcarg list - fix issue74: pyarg module names are now checked against imp.find_module false positives +- fix compatibility with twisted/trial-11.1.0 use cases Changes between 2.1.2 and 2.1.3 ---------------------------------------- diff --git a/_pytest/unittest.py b/_pytest/unittest.py index 3bcf91e90..324dab048 100644 --- a/_pytest/unittest.py +++ b/_pytest/unittest.py @@ -120,14 +120,19 @@ def pytest_runtest_protocol(item, __multicall__): ut = sys.modules['twisted.python.failure'] Failure__init__ = ut.Failure.__init__.im_func check_testcase_implements_trial_reporter() - def excstore(self, exc_value=None, exc_type=None, exc_tb=None): + def excstore(self, exc_value=None, exc_type=None, exc_tb=None, + captureVars=None): if exc_value is None: self._rawexcinfo = sys.exc_info() else: if exc_type is None: exc_type = type(exc_value) self._rawexcinfo = (exc_type, exc_value, exc_tb) - Failure__init__(self, exc_value, exc_type, exc_tb) + try: + Failure__init__(self, exc_value, exc_type, exc_tb, + captureVars=captureVars) + except TypeError: + Failure__init__(self, exc_value, exc_type, exc_tb) ut.Failure.__init__ = excstore try: return __multicall__.execute()