1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-09 21:34:05 +01:00

#N/A: Improve how version is fetched for all shells (#920)

This commit is contained in:
Pablo Aguiar
2019-05-27 18:24:55 +02:00
committed by Vladimir Iakovlev
parent ba949f7fd9
commit ff2944086d
12 changed files with 137 additions and 23 deletions

View File

@@ -116,7 +116,17 @@ class TestFish(object):
config_exists.return_value = False
assert not shell.how_to_configure().can_configure_automatically
def test_info(self, shell, Popen):
def test_get_version(self, shell, Popen):
Popen.return_value.stdout.read.side_effect = [b'fish, version 3.5.9\n']
assert shell.info() == 'Fish Shell 3.5.9'
assert shell._get_version() == '3.5.9'
assert Popen.call_args[0][0] == ['fish', '--version']
@pytest.mark.parametrize('side_effect, exception', [
([b'\n'], IndexError),
(OSError('file not found'), OSError),
])
def test_get_version_error(self, side_effect, exception, shell, Popen):
Popen.return_value.stdout.read.side_effect = side_effect
with pytest.raises(exception):
shell._get_version()
assert Popen.call_args[0][0] == ['fish', '--version']