From 32a5e80a6d805e3cefb67b201f2e960b5cdd82f9 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 5 May 2019 09:33:37 -0300 Subject: [PATCH] Add encoding: header and fix rep mock in test_line_with_reprcrash on py27 --- src/_pytest/terminal.py | 1 + testing/test_terminal.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index af836658b..5330d81cb 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -1,3 +1,4 @@ +# encoding: utf-8 """ terminal reporting of the full testing process. This is a good source for looking at the various reporting hooks. diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 35981b568..da5d9ca44 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1599,10 +1599,10 @@ def test_line_with_reprcrash(monkeypatch): monkeypatch.setattr(_pytest.terminal, "_get_pos", mock_get_pos) - class config: + class config(object): pass - class rep: + class rep(object): def _get_verbose_word(self, *args): return mocked_verbose_word @@ -1614,7 +1614,7 @@ def test_line_with_reprcrash(monkeypatch): __tracebackhide__ = True if msg: rep.longrepr.reprcrash.message = msg - actual = _get_line_with_reprcrash_message(config, rep, width) + actual = _get_line_with_reprcrash_message(config, rep(), width) assert actual == expected if actual != "%s %s" % (mocked_verbose_word, mocked_pos):