From 58ddd4338adf12a3abc2ffed0e27794a398fa8d2 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Sun, 18 Jul 2021 15:48:03 +0200 Subject: [PATCH] #1215: Initiate settings before printing the alias --- tests/entrypoints/test_alias.py | 11 ++++++++++- thefuck/entrypoints/alias.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/entrypoints/test_alias.py b/tests/entrypoints/test_alias.py index 2260c752..ddb13e1f 100644 --- a/tests/entrypoints/test_alias.py +++ b/tests/entrypoints/test_alias.py @@ -1,6 +1,6 @@ from mock import Mock import pytest -from thefuck.entrypoints.alias import _get_alias +from thefuck.entrypoints.alias import _get_alias, print_alias @pytest.mark.parametrize( @@ -28,3 +28,12 @@ def test_get_alias(monkeypatch, mocker, py2, assert alias == 'instant_mode_alias' else: assert alias == 'app_alias' + + +def test_print_alias(mocker): + settings_mock = mocker.patch('thefuck.entrypoints.alias.settings') + _get_alias_mock = mocker.patch('thefuck.entrypoints.alias._get_alias') + known_args = Mock() + print_alias(known_args) + settings_mock.init.assert_called_once_with(known_args) + _get_alias_mock.assert_called_once_with(known_args) diff --git a/thefuck/entrypoints/alias.py b/thefuck/entrypoints/alias.py index 4bcda8b7..c7094d4e 100644 --- a/thefuck/entrypoints/alias.py +++ b/thefuck/entrypoints/alias.py @@ -1,4 +1,5 @@ import six +from ..conf import settings from ..logs import warn from ..shells import shell from ..utils import which @@ -23,4 +24,5 @@ def _get_alias(known_args): def print_alias(known_args): + settings.init(known_args) print(_get_alias(known_args))