From 959d20df781edb9f283f5317f50e8000f83e7ab6 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Sat, 25 Jul 2015 21:15:42 -0300 Subject: [PATCH 1/2] Add `test_not_match` to `no_such_file` tests --- tests/rules/test_no_such_file.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/rules/test_no_such_file.py b/tests/rules/test_no_such_file.py index ba35477..3b25152 100644 --- a/tests/rules/test_no_such_file.py +++ b/tests/rules/test_no_such_file.py @@ -11,6 +11,14 @@ def test_match(command): assert match(command, None) +@pytest.mark.parametrize('command', [ + Command(script='mv foo bar/', stderr=""), + Command(script='mv foo bar/foo', stderr="mv: permission denied"), + ]) +def test_not_match(command): + assert not match(command, None) + + @pytest.mark.parametrize('command, new_command', [ (Command(script='mv foo bar/foo', stderr="mv: cannot move 'foo' to 'bar/foo': No such file or directory"), 'mkdir -p bar && mv foo bar/foo'), (Command(script='mv foo bar/', stderr="mv: cannot move 'foo' to 'bar/': No such file or directory"), 'mkdir -p bar && mv foo bar/'), From 4985f75d74377c30644a97dd4816b883265c9091 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Sat, 25 Jul 2015 23:25:34 -0300 Subject: [PATCH 2/2] Allow `generic_shell` to act while testing `git_push_pull` Fix failing tests on shells that do not use && operator --- thefuck/rules/git_push_pull.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/thefuck/rules/git_push_pull.py b/thefuck/rules/git_push_pull.py index 3529a18..f2174be 100644 --- a/thefuck/rules/git_push_pull.py +++ b/thefuck/rules/git_push_pull.py @@ -1,5 +1,4 @@ -from thefuck import utils -from thefuck.shells import and_ +from thefuck import utils, shells from thefuck.utils import replace_argument @@ -13,5 +12,5 @@ def match(command, settings): @utils.git_support def get_new_command(command, settings): - return and_(replace_argument(command.script, 'push', 'pull'), - command.script) + return shells.and_(replace_argument(command.script, 'push', 'pull'), + command.script)