From b21461be155148ce665a1a9684648ecc3794d72e Mon Sep 17 00:00:00 2001 From: Vladimir Iakovlev Date: Mon, 16 Dec 2019 21:42:37 +0100 Subject: [PATCH] N/A: Fix UnicodeDecodeError with Python 2.7 and newer versions of py.test --- tests/test_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 3e73c3d7..5c3542a7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -225,9 +225,12 @@ class TestGetValidHistoryWithoutCurrent(object): @pytest.fixture(autouse=True) def history(self, mocker): - return mocker.patch('thefuck.shells.shell.get_history', - return_value=['le cat', 'fuck', 'ls cat', - 'diff x', 'nocommand x', u'café ô']) + mock = mocker.patch('thefuck.shells.shell.get_history') + # Passing as an argument causes `UnicodeDecodeError` + # with newer py.test and python 2.7 + mock.return_value = ['le cat', 'fuck', 'ls cat', + 'diff x', 'nocommand x', u'café ô'] + return mock @pytest.fixture(autouse=True) def alias(self, mocker):