From c10f483b9f7834502b322d4119a0f87d2653eb94 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 22 Sep 2015 20:29:16 +0200 Subject: [PATCH] Don't hardcode 'std' for captured stdout/stderr. This will make Item.add_report_sect more usable for plugins. See https://github.com/eisensheng/pytest-catchlog/pull/7 --- _pytest/capture.py | 4 ++-- _pytest/runner.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 58f9cb525..f0fa72f46 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -147,8 +147,8 @@ class CaptureManager: def suspendcapture_item(self, item, when): out, err = self.suspendcapture() - item.add_report_section(when, "out", out) - item.add_report_section(when, "err", err) + item.add_report_section(when, "stdout", out) + item.add_report_section(when, "stderr", err) error_capsysfderror = "cannot use capsys and capfd at the same time" diff --git a/_pytest/runner.py b/_pytest/runner.py index 32be7dbed..6e4f45d5e 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -226,7 +226,7 @@ def pytest_runtest_makereport(item, call): longrepr = item._repr_failure_py(excinfo, style=item.config.option.tbstyle) for rwhen, key, content in item._report_sections: - sections.append(("Captured std%s %s" %(key, rwhen), content)) + sections.append(("Captured %s %s" %(key, rwhen), content)) return TestReport(item.nodeid, item.location, keywords, outcome, longrepr, when, sections, duration)