From 0769bb48980379ee9b05785b1e9fcf32687d8170 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 21 Jul 2015 12:55:18 -0300 Subject: [PATCH] Make pastebin use _pytest.config.create_terminal_writer --- _pytest/pastebin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_pytest/pastebin.py b/_pytest/pastebin.py index 4d0badbf2..6ac9d50c6 100644 --- a/_pytest/pastebin.py +++ b/_pytest/pastebin.py @@ -69,6 +69,7 @@ def create_new_paste(contents): return 'bad response: ' + response def pytest_terminal_summary(terminalreporter): + import _pytest.config if terminalreporter.config.option.pastebin != "failed": return tr = terminalreporter @@ -79,7 +80,7 @@ def pytest_terminal_summary(terminalreporter): msg = rep.longrepr.reprtraceback.reprentries[-1].reprfileloc except AttributeError: msg = tr._getfailureheadline(rep) - tw = py.io.TerminalWriter(stringio=True) + tw = _pytest.config.create_terminal_writer(terminalreporter.config, stringio=True) rep.toterminal(tw) s = tw.stringio.getvalue() assert len(s)