fix issue333: fix a case of bad unittest/pytest hook interaction.
This commit is contained in:
parent
88dc5f8204
commit
d565df90ad
|
@ -4,6 +4,8 @@ Changes between 2.3.5 and 2.4.DEV
|
||||||
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed
|
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed
|
||||||
anymore), making ``pytest.set_trace()`` a mere shortcut.
|
anymore), making ``pytest.set_trace()`` a mere shortcut.
|
||||||
|
|
||||||
|
- fix issue333: fix a case of bad unittest/pytest hook interaction.
|
||||||
|
|
||||||
- fix issue181: --pdb now also works on collect errors (and
|
- fix issue181: --pdb now also works on collect errors (and
|
||||||
on internal errors) . This was implemented by a slight internal
|
on internal errors) . This was implemented by a slight internal
|
||||||
refactoring and the introduction of a new hook
|
refactoring and the introduction of a new hook
|
||||||
|
|
|
@ -150,7 +150,10 @@ def pytest_runtest_makereport(item, call):
|
||||||
if isinstance(item, TestCaseFunction):
|
if isinstance(item, TestCaseFunction):
|
||||||
if item._excinfo:
|
if item._excinfo:
|
||||||
call.excinfo = item._excinfo.pop(0)
|
call.excinfo = item._excinfo.pop(0)
|
||||||
|
try:
|
||||||
del call.result
|
del call.result
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
# twisted trial support
|
# twisted trial support
|
||||||
def pytest_runtest_protocol(item, __multicall__):
|
def pytest_runtest_protocol(item, __multicall__):
|
||||||
|
|
|
@ -654,3 +654,21 @@ def test_no_teardown_if_setupclass_failed(testdir):
|
||||||
reprec = testdir.inline_run(testpath)
|
reprec = testdir.inline_run(testpath)
|
||||||
reprec.assertoutcome(passed=1, failed=1)
|
reprec.assertoutcome(passed=1, failed=1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_issue333_result_clearing(testdir):
|
||||||
|
testdir.makeconftest("""
|
||||||
|
def pytest_runtest_call(__multicall__, item):
|
||||||
|
__multicall__.execute()
|
||||||
|
assert 0
|
||||||
|
""")
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import unittest
|
||||||
|
class TestIt(unittest.TestCase):
|
||||||
|
def test_func(self):
|
||||||
|
0/0
|
||||||
|
""")
|
||||||
|
|
||||||
|
reprec = testdir.inline_run()
|
||||||
|
reprec.assertoutcome(failed=1)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue