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:
committed by
Vladimir Iakovlev
parent
ba949f7fd9
commit
ff2944086d
@@ -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']
|
||||
|
Reference in New Issue
Block a user