[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
|
raise
|
||||||
except:
|
except:
|
||||||
e = sys.exc_info()[1]
|
e = sys.exc_info()[1]
|
||||||
if isinstance(e, Failed):
|
if isinstance(e, Failed) and e.excinfo:
|
||||||
excinfo = e.excinfo
|
excinfo = e.excinfo
|
||||||
else:
|
else:
|
||||||
excinfo = py.code.ExceptionInfo()
|
excinfo = py.code.ExceptionInfo()
|
||||||
|
|
|
@ -37,6 +37,10 @@ class ItemTestFailingExplicit(Item):
|
||||||
def run(self):
|
def run(self):
|
||||||
raise Failed(excinfo="3")
|
raise Failed(excinfo="3")
|
||||||
|
|
||||||
|
class ItemTestFailingExplicitEmpty(Item):
|
||||||
|
def run(self):
|
||||||
|
py.test.raises(ValueError, lambda : 123)
|
||||||
|
|
||||||
class TestExecutor(BasicRsessionTest):
|
class TestExecutor(BasicRsessionTest):
|
||||||
def test_run_executor(self):
|
def test_run_executor(self):
|
||||||
ex = RunExecutor(ItemTestPassing("pass", self.config), config=self.config)
|
ex = RunExecutor(ItemTestPassing("pass", self.config), config=self.config)
|
||||||
|
@ -158,3 +162,10 @@ class TestExecutor(BasicRsessionTest):
|
||||||
outcome = ex.execute()
|
outcome = ex.execute()
|
||||||
assert not outcome.passed
|
assert not outcome.passed
|
||||||
assert outcome.excinfo == "3"
|
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