mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
commit
3358a3b540
7 changed files with 243 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import pytest
|
|||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import main
|
||||
from pre_commit.commands import hazmat
|
||||
from pre_commit.errors import FatalError
|
||||
from pre_commit.util import cmd_output
|
||||
from testing.auto_namedtuple import auto_namedtuple
|
||||
|
|
@ -157,6 +158,17 @@ def test_all_cmds(command, mock_commands, mock_store_dir):
|
|||
assert_only_one_mock_called(mock_commands)
|
||||
|
||||
|
||||
def test_hazmat(mock_store_dir):
|
||||
with mock.patch.object(hazmat, 'impl') as mck:
|
||||
main.main(('hazmat', 'cd', 'subdir', '--', 'cmd', '--', 'f1', 'f2'))
|
||||
assert mck.call_count == 1
|
||||
(arg,), dct = mck.call_args
|
||||
assert dct == {}
|
||||
assert arg.tool == 'cd'
|
||||
assert arg.subdir == 'subdir'
|
||||
assert arg.cmd == ['cmd', '--', 'f1', 'f2']
|
||||
|
||||
|
||||
def test_try_repo(mock_store_dir):
|
||||
with mock.patch.object(main, 'try_repo') as patch:
|
||||
main.main(('try-repo', '.'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue