From 2cd886f442284b81a34024e9ede8f48a63b3e6fa Mon Sep 17 00:00:00 2001 From: fijal Date: Fri, 23 Feb 2007 15:22:50 +0100 Subject: [PATCH] [svn r39340] A fix and a test. Thanks Marian Shubert for reporting problem --HG-- branch : trunk --- py/test/rsession/executor.py | 2 +- py/test/rsession/testing/test_executor.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/py/test/rsession/executor.py b/py/test/rsession/executor.py index 7fbf81823..e9966a7bf 100644 --- a/py/test/rsession/executor.py +++ b/py/test/rsession/executor.py @@ -40,7 +40,7 @@ class RunExecutor(object): raise except: e = sys.exc_info()[1] - if isinstance(e, Failed): + if isinstance(e, Failed) and e.excinfo: excinfo = e.excinfo else: excinfo = py.code.ExceptionInfo() diff --git a/py/test/rsession/testing/test_executor.py b/py/test/rsession/testing/test_executor.py index 3e5490e9a..afae001ad 100644 --- a/py/test/rsession/testing/test_executor.py +++ b/py/test/rsession/testing/test_executor.py @@ -37,6 +37,10 @@ class ItemTestFailingExplicit(Item): def run(self): raise Failed(excinfo="3") +class ItemTestFailingExplicitEmpty(Item): + def run(self): + py.test.raises(ValueError, lambda : 123) + class TestExecutor(BasicRsessionTest): def test_run_executor(self): ex = RunExecutor(ItemTestPassing("pass", self.config), config=self.config) @@ -158,3 +162,10 @@ class TestExecutor(BasicRsessionTest): outcome = ex.execute() assert not outcome.passed assert outcome.excinfo == "3" + + def test_executor_explicit_Faile_no_excinfo(self): + ex = RunExecutor(ItemTestFailingExplicitEmpty("failexx", self.config), + config=self.config) + outcome = ex.execute() + assert not outcome.passed +