mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 08:34:41 +04:00
Code cleanup and tests
This commit is contained in:
parent
5f392f0ba5
commit
9b92f96ed0
7 changed files with 92 additions and 21 deletions
3
testing/resources/docker_hooks_repo/Dockerfile
Normal file
3
testing/resources/docker_hooks_repo/Dockerfile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
FROM cogniteev/echo
|
||||
|
||||
CMD ["echo", "This is overwritten by the hooks.yaml 'entry'"]
|
||||
11
testing/resources/docker_hooks_repo/hooks.yaml
Normal file
11
testing/resources/docker_hooks_repo/hooks.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
- id: docker-hook
|
||||
name: Docker test hook
|
||||
entry: echo
|
||||
language: docker
|
||||
files: \.txt$
|
||||
|
||||
- id: docker-hook-failing
|
||||
name: Docker test hook with nonzero exit code
|
||||
entry: bork
|
||||
language: docker
|
||||
files: \.txt$
|
||||
|
|
@ -6,6 +6,7 @@ import shutil
|
|||
import jsonschema
|
||||
import pytest
|
||||
|
||||
from pre_commit.languages.docker import docker_is_running
|
||||
from pre_commit.util import cmd_output
|
||||
from pre_commit.util import cwd
|
||||
|
||||
|
|
@ -57,6 +58,11 @@ def cmd_output_mocked_pre_commit_home(*args, **kwargs):
|
|||
return cmd_output(*args, env=env, **kwargs)
|
||||
|
||||
|
||||
skipif_cant_run_docker = pytest.mark.skipif(
|
||||
docker_is_running() is False,
|
||||
reason='Docker isn\'t running or can\'t be accessed'
|
||||
)
|
||||
|
||||
skipif_slowtests_false = pytest.mark.skipif(
|
||||
os.environ.get('slowtests') == 'false',
|
||||
reason='slowtests=false',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue