fix issue89 apply Daniel Nouri's patch to doctest/--pdb interaction.
This commit is contained in:
parent
9d3e51af9f
commit
a51e52aee3
1
AUTHORS
1
AUTHORS
|
@ -22,3 +22,4 @@ Jan Balster
|
||||||
Grig Gheorghiu
|
Grig Gheorghiu
|
||||||
Bob Ippolito
|
Bob Ippolito
|
||||||
Christian Tismer
|
Christian Tismer
|
||||||
|
Daniel Nuri
|
||||||
|
|
|
@ -14,6 +14,7 @@ Changes between 2.1.3 and XXX 2.2.0
|
||||||
- new feature to help optimizing the speed of your tests:
|
- new feature to help optimizing the speed of your tests:
|
||||||
--durations=N option for displaying N slowest test calls
|
--durations=N option for displaying N slowest test calls
|
||||||
and setup/teardown methods.
|
and setup/teardown methods.
|
||||||
|
- fix issue89: --pdb with unexpected exceptions in doctest work more sensibly
|
||||||
- fix and cleanup pytest's own test suite to not leak FDs
|
- fix and cleanup pytest's own test suite to not leak FDs
|
||||||
- fix issue83: link to generated funcarg list
|
- fix issue83: link to generated funcarg list
|
||||||
- fix issue74: pyarg module names are now checked against imp.find_module false positives
|
- fix issue74: pyarg module names are now checked against imp.find_module false positives
|
||||||
|
|
|
@ -70,7 +70,13 @@ class PdbInvoke:
|
||||||
tw.sep(">", "traceback")
|
tw.sep(">", "traceback")
|
||||||
rep.toterminal(tw)
|
rep.toterminal(tw)
|
||||||
tw.sep(">", "entering PDB")
|
tw.sep(">", "entering PDB")
|
||||||
post_mortem(call.excinfo._excinfo[2])
|
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||||
|
# Use the underlying exception instead:
|
||||||
|
if isinstance(call.excinfo.value, py.std.doctest.UnexpectedException):
|
||||||
|
tb = call.excinfo.value.exc_info[2]
|
||||||
|
else:
|
||||||
|
tb = call.excinfo._excinfo[2]
|
||||||
|
post_mortem(tb)
|
||||||
rep._pdbshown = True
|
rep._pdbshown = True
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ If you want to install or upgrade pytest you might just type::
|
||||||
most code probably "just" works because the hook was already called
|
most code probably "just" works because the hook was already called
|
||||||
for failing setup/teardown phases of a test.
|
for failing setup/teardown phases of a test.
|
||||||
|
|
||||||
Thanks to Ronny Pfannschmidt, David Burns, Jeff Donner XXX for their
|
Thanks to Ronny Pfannschmidt, David Burns, Jeff Donner, Daniel Nouri, XXX for their
|
||||||
help and feedback on various issues.
|
help and feedback on various issues.
|
||||||
|
|
||||||
best,
|
best,
|
||||||
|
|
|
@ -106,6 +106,26 @@ class TestPDB:
|
||||||
if child.isalive():
|
if child.isalive():
|
||||||
child.wait()
|
child.wait()
|
||||||
|
|
||||||
|
def test_pdb_interaction_doctest(self, testdir):
|
||||||
|
p1 = testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
def function_1():
|
||||||
|
'''
|
||||||
|
>>> i = 0
|
||||||
|
>>> assert i == 1
|
||||||
|
'''
|
||||||
|
""")
|
||||||
|
child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1)
|
||||||
|
child.expect("(Pdb)")
|
||||||
|
child.sendline('i')
|
||||||
|
child.expect("0")
|
||||||
|
child.expect("(Pdb)")
|
||||||
|
child.sendeof()
|
||||||
|
rest = child.read()
|
||||||
|
assert "1 failed" in rest
|
||||||
|
if child.isalive():
|
||||||
|
child.wait()
|
||||||
|
|
||||||
def test_pdb_interaction_capturing_twice(self, testdir):
|
def test_pdb_interaction_capturing_twice(self, testdir):
|
||||||
p1 = testdir.makepyfile("""
|
p1 = testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
Loading…
Reference in New Issue