summaryrefslogtreecommitdiffstats
path: root/tests/languages/docker_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:18 +0000
commita75e61fbe483eb1f3bbfb2d61d7c15615f56172b (patch)
tree2200a67ca0cbe0c8091c69a447c70c3b0ca0a79c /tests/languages/docker_test.py
parentAdding upstream version 3.0.4. (diff)
downloadpre-commit-a75e61fbe483eb1f3bbfb2d61d7c15615f56172b.tar.xz
pre-commit-a75e61fbe483eb1f3bbfb2d61d7c15615f56172b.zip
Adding upstream version 3.1.0.upstream/3.1.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/languages/docker_test.py')
-rw-r--r--tests/languages/docker_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/languages/docker_test.py b/tests/languages/docker_test.py
index 5f7c85e..836382a 100644
--- a/tests/languages/docker_test.py
+++ b/tests/languages/docker_test.py
@@ -11,6 +11,8 @@ import pytest
from pre_commit.languages import docker
from pre_commit.util import CalledProcessError
+from testing.language_helpers import run_language
+from testing.util import xfailif_windows
DOCKER_CGROUP_EXAMPLE = b'''\
12:hugetlb:/docker/c33988ec7651ebc867cb24755eaf637a6734088bc7eef59d5799293a9e5450f7
@@ -181,3 +183,15 @@ def test_get_docker_path_in_docker_docker_in_docker(in_docker):
err = CalledProcessError(1, (), b'', b'')
with mock.patch.object(docker, 'cmd_output_b', side_effect=err):
assert docker._get_docker_path('/project') == '/project'
+
+
+@xfailif_windows # pragma: win32 no cover
+def test_docker_hook(tmp_path):
+ dockerfile = '''\
+FROM ubuntu:22.04
+CMD ["echo", "This is overwritten by the entry"']
+'''
+ tmp_path.joinpath('Dockerfile').write_text(dockerfile)
+
+ ret = run_language(tmp_path, docker, 'echo hello hello world')
+ assert ret == (0, b'hello hello world\n')