Add pre-commit try-repo

`try-repo` is useful for:
- Trying out a remote hook repository without needing to configure it.
- Testing a hook repository while developing it.
This commit is contained in:
Anthony Sottile 2017-10-07 15:13:53 -07:00
parent e8641ee0a3
commit 2c88791a7f
15 changed files with 254 additions and 110 deletions

View file

@ -92,12 +92,18 @@ def test_help_other_command(
@pytest.mark.parametrize('command', CMDS)
def test_install_command(command, mock_commands):
def test_all_cmds(command, mock_commands):
main.main((command,))
assert getattr(mock_commands, command.replace('-', '_')).call_count == 1
assert_only_one_mock_called(mock_commands)
def test_try_repo():
with mock.patch.object(main, 'try_repo') as patch:
main.main(('try-repo', '.'))
assert patch.call_count == 1
def test_help_cmd_in_empty_directory(
mock_commands,
tempdir_factory,