From 78bae2dd04adb3423010a6906f459ab1892a29b0 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 25 May 2009 14:21:21 +0200 Subject: [PATCH] fix a bug that collectonly reporting did not show internal errors (thanks ronny) --HG-- branch : trunk --- py/test/plugin/pytest_terminal.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index bedf91b0b..998e5dd7c 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -349,6 +349,10 @@ class CollectonlyReporter: def outindent(self, line): self.out.line(self.indent + str(line)) + def pytest_internalerror(self, excrepr): + for line in str(excrepr).split("\n"): + self.out.line("INTERNALERROR> " + line) + def pytest_collectstart(self, collector): self.outindent(collector) self.indent += self.INDENT @@ -740,6 +744,17 @@ class TestCollectonly: !!! ValueError: 0 !!! """) + def test_collectonly_fatal(self, testdir): + p1 = testdir.makeconftest(""" + def pytest_collectstart(collector): + assert 0, "urgs" + """) + result = testdir.runpytest("--collectonly") + result.stdout.fnmatch_lines([ + "*INTERNAL*args*" + ]) + assert result.ret == 3 + def test_repr_python_version(monkeypatch): monkeypatch.setattr(sys, 'version_info', (2, 5, 1, 'final', 0)) assert repr_pythonversion() == "2.5.1-final-0"