mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-30 06:34:09 +00:00
Move utility functions from archlinux to utils
This commit is contained in:
@@ -29,7 +29,7 @@ def test_match(command):
|
||||
@pytest.mark.parametrize('command, return_value', [
|
||||
(Command(script='vim', stderr='vim: command not found'), PKGFILE_OUTPUT_VIM),
|
||||
(Command(script='sudo vim', stderr='sudo: vim: command not found'), PKGFILE_OUTPUT_VIM)])
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch('thefuck.utils.subprocess')
|
||||
@patch.multiple(pacman, create=True, pacman=pacman_cmd)
|
||||
def test_match_mocked(subp_mock, command, return_value):
|
||||
subp_mock.check_output.return_value = return_value
|
||||
@@ -75,7 +75,7 @@ def test_get_new_command(command, new_command, mocker):
|
||||
(Command('convert'), ['{} -S extra/imagemagick && convert'.format(pacman_cmd)], PKGFILE_OUTPUT_CONVERT),
|
||||
(Command('sudo'), ['{} -S core/sudo && sudo'.format(pacman_cmd)], PKGFILE_OUTPUT_SUDO),
|
||||
(Command('sudo convert'), ['{} -S extra/imagemagick && sudo convert'.format(pacman_cmd)], PKGFILE_OUTPUT_CONVERT)])
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch('thefuck.utils.subprocess')
|
||||
@patch.multiple(pacman, create=True, pacman=pacman_cmd)
|
||||
def test_get_new_command_mocked(subp_mock, command, new_command, return_value):
|
||||
subp_mock.check_output.return_value = return_value
|
||||
|
||||
@@ -22,7 +22,7 @@ def test_match(command):
|
||||
Command(script='yaourt -S llc', stderr='error: target not found: llc'),
|
||||
Command(script='pacman llc', stderr='error: target not found: llc'),
|
||||
Command(script='sudo pacman llc', stderr='error: target not found: llc')])
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch('thefuck.utils.subprocess')
|
||||
def test_match_mocked(subp_mock, command):
|
||||
subp_mock.check_output.return_value = PKGFILE_OUTPUT_LLC
|
||||
assert match(command, None)
|
||||
@@ -42,7 +42,7 @@ def test_get_new_command(command, fixed):
|
||||
(Command(script='yaourt -S llc', stderr='error: target not found: llc'), ['yaourt -S extra/llvm', 'yaourt -S extra/llvm35']),
|
||||
(Command(script='pacman -S llc', stderr='error: target not found: llc'), ['pacman -S extra/llvm', 'pacman -S extra/llvm35']),
|
||||
(Command(script='sudo pacman -S llc', stderr='error: target not found: llc'), ['sudo pacman -S extra/llvm', 'sudo pacman -S extra/llvm35'])])
|
||||
@patch('thefuck.archlinux.subprocess')
|
||||
@patch('thefuck.utils.subprocess')
|
||||
def test_get_new_command_mocked(subp_mock, command, fixed):
|
||||
subp_mock.check_output.return_value = PKGFILE_OUTPUT_LLC
|
||||
assert get_new_command(command, None) == fixed
|
||||
|
||||
Reference in New Issue
Block a user