fix --pdb to not drop interactive on xfailed tests
--HG-- branch : trunk
This commit is contained in:
parent
72de7d94fd
commit
3f1efe1b57
|
@ -34,6 +34,7 @@ New features
|
|||
Bug fixes / Maintenance
|
||||
++++++++++++++++++++++++++
|
||||
|
||||
- fix --pdb to ignore xfailed tests and unify its TB-reporting
|
||||
- fix assertion interpretation with the ** operator
|
||||
- fix issue105 assignment on the same line as a failing assertion
|
||||
- fix issue104 proper escaping for test names in junitxml plugin
|
||||
|
|
|
@ -15,19 +15,21 @@ def pytest_configure(config):
|
|||
config.pluginmanager.register(PdbInvoke(), 'pdb')
|
||||
|
||||
class PdbInvoke:
|
||||
def pytest_runtest_makereport(self, item, call):
|
||||
if call.excinfo and not \
|
||||
call.excinfo.errisinstance(py.test.skip.Exception):
|
||||
# play well with capturing, slightly hackish
|
||||
capman = item.config.pluginmanager.getplugin('capturemanager')
|
||||
capman.suspendcapture()
|
||||
|
||||
tw = py.io.TerminalWriter()
|
||||
repr = call.excinfo.getrepr()
|
||||
repr.toterminal(tw)
|
||||
post_mortem(call.excinfo._excinfo[2])
|
||||
|
||||
capman.resumecapture_item(item)
|
||||
def pytest_runtest_makereport(self, item, call, __multicall__):
|
||||
if not call.excinfo or \
|
||||
call.excinfo.errisinstance(py.test.skip.Exception):
|
||||
return
|
||||
rep = __multicall__.execute()
|
||||
if "xfail" in rep.keywords:
|
||||
return rep
|
||||
# we assume that the above execute() suspended capturing
|
||||
tw = py.io.TerminalWriter()
|
||||
tw.line()
|
||||
tw.sep(">", "traceback")
|
||||
rep.toterminal(tw)
|
||||
tw.sep(">", "entering PDB")
|
||||
post_mortem(call.excinfo._excinfo[2])
|
||||
return rep
|
||||
|
||||
class Pdb(py.std.pdb.Pdb):
|
||||
def do_list(self, arg):
|
||||
|
|
|
@ -6,8 +6,8 @@ import inspect
|
|||
from py._plugin import hookspec
|
||||
|
||||
default_plugins = (
|
||||
"default runner capture mark terminal skipping tmpdir monkeypatch "
|
||||
"recwarn pdb pastebin unittest helpconfig nose assertion genscript "
|
||||
"default runner pdb capture mark terminal skipping tmpdir monkeypatch "
|
||||
"recwarn pastebin unittest helpconfig nose assertion genscript "
|
||||
"junitxml doctest").split()
|
||||
|
||||
def check_old_use(mod, modname):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
docutils
|
||||
pygments
|
||||
pexpect
|
||||
figleaf
|
||||
hg+http://bitbucket.org/hpk42/execnet#egg=execnet
|
||||
|
|
|
@ -20,6 +20,16 @@ class TestPDB:
|
|||
tb = py.code.Traceback(pdblist[0][0])
|
||||
assert tb[-1].name == "test_func"
|
||||
|
||||
def test_pdb_on_xfail(self, testdir, pdblist):
|
||||
rep = testdir.inline_runsource1('--pdb', """
|
||||
import py
|
||||
@py.test.mark.xfail
|
||||
def test_func():
|
||||
assert 0
|
||||
""")
|
||||
assert "xfail" in rep.keywords
|
||||
assert not pdblist
|
||||
|
||||
def test_pdb_on_skip(self, testdir, pdblist):
|
||||
rep = testdir.inline_runsource1('--pdb', """
|
||||
import py
|
||||
|
|
Loading…
Reference in New Issue