From 149f9e1042be1c68f26ca756a856819c101405ae Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 17 Jun 2010 12:53:29 +0200 Subject: [PATCH] refine reporting with --pdb some more --HG-- branch : trunk --- CHANGELOG | 3 ++- py/_plugin/pytest_pdb.py | 3 +++ testing/plugin/test_pytest_pdb.py | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7155d70fd..e3360318a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,7 +34,8 @@ New features Bug fixes / Maintenance ++++++++++++++++++++++++++ -- fix --pdb to ignore xfailed tests and unify its TB-reporting +- refine --pdb: ignore xfailed tests, unify its TB-reporting and + don't display failures again at the end. - 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 diff --git a/py/_plugin/pytest_pdb.py b/py/_plugin/pytest_pdb.py index a08318d92..7bcd5b98d 100644 --- a/py/_plugin/pytest_pdb.py +++ b/py/_plugin/pytest_pdb.py @@ -15,6 +15,9 @@ def pytest_configure(config): config.pluginmanager.register(PdbInvoke(), 'pdb') class PdbInvoke: + def pytest_sessionfinish(self, session): + # don't display failures again at the end + session.config.option.tbstyle = "no" def pytest_runtest_makereport(self, item, call, __multicall__): if not call.excinfo or \ call.excinfo.errisinstance(py.test.skip.Exception): diff --git a/testing/plugin/test_pytest_pdb.py b/testing/plugin/test_pytest_pdb.py index 8a9f07ce2..87a98a504 100644 --- a/testing/plugin/test_pytest_pdb.py +++ b/testing/plugin/test_pytest_pdb.py @@ -50,7 +50,9 @@ class TestPDB: child.expect(".*i = 0") child.expect("(Pdb)") child.sendeof() - child.expect("1 failed") + rest = child.read() + assert "1 failed" in rest + assert "def test_1" not in rest if child.isalive(): child.wait()