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