[svn r39340] A fix and a test. Thanks Marian Shubert for reporting problem
--HG-- branch : trunk
This commit is contained in:
parent
e4ef5d39bf
commit
2cd886f442
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue