mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
Move commands into their own files.
This commit is contained in:
parent
111ed02938
commit
cdfd3f7670
16 changed files with 736 additions and 673 deletions
25
tests/commands/install_test.py
Normal file
25
tests/commands/install_test.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import io
|
||||
import os
|
||||
import os.path
|
||||
import pkg_resources
|
||||
import stat
|
||||
|
||||
from pre_commit.commands.install import install
|
||||
from pre_commit.runner import Runner
|
||||
|
||||
|
||||
def test_install_pre_commit(empty_git_dir):
|
||||
runner = Runner(empty_git_dir)
|
||||
ret = install(runner)
|
||||
assert ret == 0
|
||||
assert os.path.exists(runner.pre_commit_path)
|
||||
pre_commit_contents = io.open(runner.pre_commit_path).read()
|
||||
pre_commit_sh = pkg_resources.resource_filename(
|
||||
'pre_commit', 'resources/pre-commit.sh',
|
||||
)
|
||||
expected_contents = io.open(pre_commit_sh).read()
|
||||
assert pre_commit_contents == expected_contents
|
||||
stat_result = os.stat(runner.pre_commit_path)
|
||||
assert stat_result.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
||||
Loading…
Add table
Add a link
Reference in a new issue