From 9ed41171756a80bb17113348a8f5efab2e11d292 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Mon, 28 Mar 2022 19:46:04 +0200 Subject: [PATCH] #1279: Test pacman_not_found's match not matching --- tests/rules/test_pacman_not_found.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/rules/test_pacman_not_found.py b/tests/rules/test_pacman_not_found.py index 22c0609..ca18350 100644 --- a/tests/rules/test_pacman_not_found.py +++ b/tests/rules/test_pacman_not_found.py @@ -32,6 +32,18 @@ def test_match_mocked(subp_mock, command): assert match(command) +@pytest.mark.parametrize('command', [ + Command('zaz -S llc', 'sh: zaz: command not found'), + Command('pikachu -S llc', 'sh: pikachu: command not found'), + Command('yogurt -S llc', 'sh: yogurt: command not found'), + Command('batman llc', 'sh: batman: command not found'), + Command('sudo batman llc', 'sudo: batman: command not found')]) +@patch('thefuck.specific.archlinux.subprocess') +def test_not_match_mocked(subp_mock, command): + subp_mock.check_output.return_value = "" + assert not match(command) + + @pytest.mark.skipif(not getattr(pacman_not_found, 'enabled_by_default', True), reason='Skip if pacman is not available') @pytest.mark.parametrize('command, fixed', [