#620: Add --debug

This commit is contained in:
Vladimir Iakovlev
2017-03-28 13:09:11 +02:00
parent d47ff8cbf2
commit c3eca8234a
4 changed files with 32 additions and 12 deletions
+14 -9
View File
@@ -5,22 +5,27 @@ from thefuck.const import ARGUMENT_PLACEHOLDER
@pytest.mark.parametrize('argv, result', [
(['thefuck'], {'alias': None, 'command': [], 'yes': False,
'help': False, 'version': False}),
(['thefuck', '-a'], {'alias': 'fuck', 'command': [], 'yes': False,
'help': False, 'version': False}),
(['thefuck', '-a', 'fix'], {'alias': 'fix', 'command': [], 'yes': False,
'help': False, 'version': False}),
'help': False, 'version': False, 'debug': False}),
(['thefuck', '-a'],
{'alias': 'fuck', 'command': [], 'yes': False,
'help': False, 'version': False, 'debug': False}),
(['thefuck', '-a', 'fix'],
{'alias': 'fix', 'command': [], 'yes': False,
'help': False, 'version': False, 'debug': False}),
(['thefuck', 'git', 'branch', ARGUMENT_PLACEHOLDER, '-y'],
{'alias': None, 'command': ['git', 'branch'], 'yes': True,
'help': False, 'version': False}),
'help': False, 'version': False, 'debug': False}),
(['thefuck', 'git', 'branch', '-a', ARGUMENT_PLACEHOLDER, '-y'],
{'alias': None, 'command': ['git', 'branch', '-a'], 'yes': True,
'help': False, 'version': False}),
'help': False, 'version': False, 'debug': False}),
(['thefuck', ARGUMENT_PLACEHOLDER, '-v'],
{'alias': None, 'command': [], 'yes': False, 'help': False,
'version': True}),
'version': True, 'debug': False}),
(['thefuck', ARGUMENT_PLACEHOLDER, '--help'],
{'alias': None, 'command': [], 'yes': False, 'help': True,
'version': False})])
'version': False, 'debug': False}),
(['thefuck', 'git', 'branch', '-a', ARGUMENT_PLACEHOLDER, '-y', '-d'],
{'alias': None, 'command': ['git', 'branch', '-a'], 'yes': True,
'help': False, 'version': False, 'debug': True})])
def test_parse(argv, result):
assert vars(Parser().parse(argv)) == result
+6
View File
@@ -79,6 +79,12 @@ class TestSettingsFromEnv(object):
assert settings.rules == const.DEFAULT_RULES + ['bash', 'lisp']
def test_settings_from_args(settings):
settings.init(Mock(yes=True, debug=True))
assert not settings.require_confirmation
assert settings.debug
class TestInitializeSettingsFile(object):
def test_ignore_if_exists(self, settings):
settings_path_mock = Mock(is_file=Mock(return_value=True), open=Mock())