1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-11 22:34:01 +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

@@ -61,3 +61,17 @@ class TestTcsh(object):
config_exists):
config_exists.return_value = False
assert not shell.how_to_configure().can_configure_automatically
def test_info(self, shell, Popen):
Popen.return_value.stdout.read.side_effect = [
b'tcsh 6.20.00 (Astron) 2016-11-24 (unknown-unknown-bsd44) \n']
assert shell.info() == 'Tcsh 6.20.00'
assert Popen.call_args[0][0] == ['tcsh', '--version']
@pytest.mark.parametrize('side_effect, exception', [
([b'\n'], IndexError), (OSError, 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] == ['tcsh', '--version']