[svn r39340] A fix and a test. Thanks Marian Shubert for reporting problem

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-23 15:22:50 +01:00
parent e4ef5d39bf
commit 2cd886f442
2 changed files with 12 additions and 1 deletions

View File

@ -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()

View File

@ -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