From 18306a4644ee8589a560e44f9ec70b69935b6843 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 20 Jun 2012 00:16:47 +0200 Subject: [PATCH] add header info: always report 3rd party plugins in test runs --- CHANGELOG | 1 + _pytest/terminal.py | 11 +++++++++++ testing/test_terminal.py | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 67054d240..35da2e74b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Changes between 2.2.4 and 2.2.5.dev ----------------------------------- +- always report installed 3rd party plugins - fix issue160: a failing setup of an xfail-marked tests should be reported as xfail (not xpass) - fix issue128: show captured output when capsys/capfd are used diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 6446ac706..28d4fd99e 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -263,6 +263,17 @@ class TerminalReporter: for line in flatten(lines): self.write_line(line) + def pytest_report_header(self, config): + plugininfo = config.pluginmanager._plugin_distinfo + if plugininfo: + l = [] + for dist, plugin in plugininfo: + name = dist.project_name + if name.startswith("pytest-"): + name = name[7:] + l.append(name) + return "plugins: %s" % ", ".join(l) + def pytest_collection_finish(self, session): if self.config.option.collectonly: self._printcollecteditems(session.items) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 1c006e62c..06532fe53 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -416,6 +416,10 @@ class TestTerminalFunctional: "*test_header_trailer_info.py .", "=* 1 passed in *.[0-9][0-9] seconds *=", ]) + if pytest.config.pluginmanager._plugin_distinfo: + result.stdout.fnmatch_lines([ + "plugins: *", + ]) def test_showlocals(self, testdir): p1 = testdir.makepyfile("""