summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-27 10:32:22 +0000
commitd7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8 (patch)
treef7d340787b36afcb3b78f2a0875c2c9c8419cdec /testing
parentReleasing debian version 3.0.4-1. (diff)
downloadpre-commit-d7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8.tar.xz
pre-commit-d7784aa0c412c80cfcb33a29fd1b2ea69dbe8ab8.zip
Merging upstream version 3.1.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing')
-rw-r--r--testing/language_helpers.py15
-rwxr-xr-xtesting/languages79
-rw-r--r--testing/resources/docker_hooks_repo/.pre-commit-hooks.yaml17
-rw-r--r--testing/resources/docker_hooks_repo/Dockerfile3
-rw-r--r--testing/resources/docker_image_hooks_repo/.pre-commit-hooks.yaml8
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/.pre-commit-hooks.yaml12
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/dotnet_hooks_combo_repo.sln28
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs12
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj12
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs12
-rw-r--r--testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj12
-rw-r--r--testing/resources/dotnet_hooks_csproj_prefix_repo/.gitignore3
-rw-r--r--testing/resources/dotnet_hooks_csproj_prefix_repo/.pre-commit-hooks.yaml5
-rw-r--r--testing/resources/dotnet_hooks_csproj_prefix_repo/Program.cs12
-rw-r--r--testing/resources/dotnet_hooks_csproj_prefix_repo/dotnet_hooks_csproj_prefix_repo.csproj9
-rw-r--r--testing/resources/dotnet_hooks_csproj_repo/.gitignore3
-rw-r--r--testing/resources/dotnet_hooks_csproj_repo/.pre-commit-hooks.yaml5
-rw-r--r--testing/resources/dotnet_hooks_csproj_repo/Program.cs12
-rw-r--r--testing/resources/dotnet_hooks_csproj_repo/dotnet_hooks_csproj_repo.csproj9
-rw-r--r--testing/resources/dotnet_hooks_sln_repo/.gitignore3
-rw-r--r--testing/resources/dotnet_hooks_sln_repo/.pre-commit-hooks.yaml5
-rw-r--r--testing/resources/dotnet_hooks_sln_repo/Program.cs12
-rw-r--r--testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.csproj9
-rw-r--r--testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.sln34
-rw-r--r--testing/resources/golang_hooks_repo/.pre-commit-hooks.yaml5
-rw-r--r--testing/resources/golang_hooks_repo/go.mod5
-rw-r--r--testing/resources/golang_hooks_repo/go.sum2
-rw-r--r--testing/resources/golang_hooks_repo/golang-hello-world/main.go23
-rw-r--r--testing/resources/python_venv_hooks_repo/.pre-commit-hooks.yaml5
-rw-r--r--testing/resources/python_venv_hooks_repo/foo.py9
-rw-r--r--testing/resources/python_venv_hooks_repo/setup.py10
-rw-r--r--testing/util.py15
32 files changed, 88 insertions, 317 deletions
diff --git a/testing/language_helpers.py b/testing/language_helpers.py
index b9c5384..ead8dae 100644
--- a/testing/language_helpers.py
+++ b/testing/language_helpers.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import os
from typing import Sequence
-from pre_commit.languages.all import Language
+from pre_commit.lang_base import Language
from pre_commit.prefix import Prefix
@@ -16,13 +16,16 @@ def run_language(
version: str | None = None,
deps: Sequence[str] = (),
is_local: bool = False,
+ require_serial: bool = True,
+ color: bool = False,
) -> tuple[int, bytes]:
prefix = Prefix(str(path))
version = version or language.get_default_version()
- language.install_environment(prefix, version, deps)
- health_error = language.health_check(prefix, version)
- assert health_error is None, health_error
+ if language.ENVIRONMENT_DIR is not None:
+ language.install_environment(prefix, version, deps)
+ health_error = language.health_check(prefix, version)
+ assert health_error is None, health_error
with language.in_env(prefix, version):
ret, out = language.run_hook(
prefix,
@@ -30,8 +33,8 @@ def run_language(
args,
file_args,
is_local=is_local,
- require_serial=True,
- color=False,
+ require_serial=require_serial,
+ color=color,
)
out = out.replace(b'\r\n', b'\n')
return ret, out
diff --git a/testing/languages b/testing/languages
new file mode 100755
index 0000000..5e8fc9e
--- /dev/null
+++ b/testing/languages
@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+from __future__ import annotations
+
+import argparse
+import concurrent.futures
+import json
+import os.path
+import subprocess
+import sys
+
+EXCLUDED = frozenset((
+ ('windows-latest', 'docker'),
+ ('windows-latest', 'docker_image'),
+ ('windows-latest', 'lua'),
+ ('windows-latest', 'swift'),
+))
+
+
+def _lang_files(lang: str) -> frozenset[str]:
+ prog = f'''\
+import json
+import os.path
+import sys
+
+import pre_commit.languages.{lang}
+import tests.languages.{lang}_test
+
+modules = sorted(
+ os.path.relpath(v.__file__)
+ for k, v in sys.modules.items()
+ if k.startswith(('pre_commit.', 'tests.', 'testing.'))
+)
+print(json.dumps(modules))
+'''
+ out = json.loads(subprocess.check_output((sys.executable, '-c', prog)))
+ return frozenset(out)
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--all', action='store_true')
+ args = parser.parse_args()
+
+ langs = [
+ os.path.splitext(fname)[0]
+ for fname in sorted(os.listdir('pre_commit/languages'))
+ if fname.endswith('.py') and fname != '__init__.py'
+ ]
+
+ if not args.all:
+ with concurrent.futures.ThreadPoolExecutor(os.cpu_count()) as exe:
+ by_lang = {
+ lang: files
+ for lang, files in zip(langs, exe.map(_lang_files, langs))
+ }
+
+ diff_cmd = ('git', 'diff', '--name-only', 'origin/main...HEAD')
+ files = set(subprocess.check_output(diff_cmd).decode().splitlines())
+
+ langs = [
+ lang
+ for lang, lang_files in by_lang.items()
+ if lang_files & files
+ ]
+
+ matched = [
+ {'os': os, 'language': lang}
+ for os in ('windows-latest', 'ubuntu-latest')
+ for lang in langs
+ if (os, lang) not in EXCLUDED
+ ]
+
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
+ f.write(f'languages={json.dumps(matched)}\n')
+ return 0
+
+
+if __name__ == '__main__':
+ raise SystemExit(main())
diff --git a/testing/resources/docker_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/docker_hooks_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index 5295739..0000000
--- a/testing/resources/docker_hooks_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-- id: docker-hook
- name: Docker test hook
- entry: echo
- language: docker
- files: \.txt$
-
-- id: docker-hook-arg
- name: Docker test hook
- entry: echo -n
- language: docker
- files: \.txt$
-
-- id: docker-hook-failing
- name: Docker test hook with nonzero exit code
- entry: bork
- language: docker
- files: \.txt$
diff --git a/testing/resources/docker_hooks_repo/Dockerfile b/testing/resources/docker_hooks_repo/Dockerfile
deleted file mode 100644
index 0bd1de0..0000000
--- a/testing/resources/docker_hooks_repo/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM ubuntu:focal
-
-CMD ["echo", "This is overwritten by the .pre-commit-hooks.yaml 'entry'"]
diff --git a/testing/resources/docker_image_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/docker_image_hooks_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index e9fb245..0000000
--- a/testing/resources/docker_image_hooks_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-- id: echo-entrypoint
- name: echo (via --entrypoint)
- language: docker_image
- entry: --entrypoint echo ubuntu:focal
-- id: echo-cmd
- name: echo (via cmd)
- language: docker_image
- entry: ubuntu:focal echo
diff --git a/testing/resources/dotnet_hooks_combo_repo/.pre-commit-hooks.yaml b/testing/resources/dotnet_hooks_combo_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index f221854..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-- id: dotnet-example-hook
- name: Test Project 1
- description: Test Project 1
- entry: proj1
- language: dotnet
- stages: [commit]
-- id: proj2
- name: Test Project 2
- description: Test Project 2
- entry: proj2
- language: dotnet
- stages: [commit]
diff --git a/testing/resources/dotnet_hooks_combo_repo/dotnet_hooks_combo_repo.sln b/testing/resources/dotnet_hooks_combo_repo/dotnet_hooks_combo_repo.sln
deleted file mode 100644
index edb0fcb..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/dotnet_hooks_combo_repo.sln
+++ /dev/null
@@ -1,28 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30114.105
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proj1", "proj1\proj1.csproj", "{38A939C3-DEA4-47D7-9B75-0418C4249662}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proj2", "proj2\proj2.csproj", "{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {38A939C3-DEA4-47D7-9B75-0418C4249662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {38A939C3-DEA4-47D7-9B75-0418C4249662}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {38A939C3-DEA4-47D7-9B75-0418C4249662}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {38A939C3-DEA4-47D7-9B75-0418C4249662}.Release|Any CPU.Build.0 = Release|Any CPU
- {4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
diff --git a/testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs b/testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs
deleted file mode 100644
index 03876f5..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace proj1
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Hello from dotnet!\n");
- }
- }
-}
diff --git a/testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj b/testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj
deleted file mode 100644
index 861ced6..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net6</TargetFramework>
-
- <PackAsTool>true</PackAsTool>
- <ToolCommandName>proj1</ToolCommandName>
- <PackageOutputPath>./nupkg</PackageOutputPath>
- </PropertyGroup>
-
-</Project>
diff --git a/testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs b/testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs
deleted file mode 100644
index 47a99a3..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace proj2
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello World!");
- }
- }
-}
diff --git a/testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj b/testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj
deleted file mode 100644
index dfce2ca..0000000
--- a/testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net6</TargetFramework>
-
- <PackAsTool>true</PackAsTool>
- <ToolCommandName>proj2</ToolCommandName>
- <PackageOutputPath>./nupkg</PackageOutputPath>
- </PropertyGroup>
-
-</Project>
diff --git a/testing/resources/dotnet_hooks_csproj_prefix_repo/.gitignore b/testing/resources/dotnet_hooks_csproj_prefix_repo/.gitignore
deleted file mode 100644
index edcd28f..0000000
--- a/testing/resources/dotnet_hooks_csproj_prefix_repo/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/
-obj/
-nupkg/
diff --git a/testing/resources/dotnet_hooks_csproj_prefix_repo/.pre-commit-hooks.yaml b/testing/resources/dotnet_hooks_csproj_prefix_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index 6626627..0000000
--- a/testing/resources/dotnet_hooks_csproj_prefix_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- id: dotnet-example-hook
- name: dotnet example hook
- entry: testeroni.tool
- language: dotnet
- files: ''
diff --git a/testing/resources/dotnet_hooks_csproj_prefix_repo/Program.cs b/testing/resources/dotnet_hooks_csproj_prefix_repo/Program.cs
deleted file mode 100644
index 1456e8e..0000000
--- a/testing/resources/dotnet_hooks_csproj_prefix_repo/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace dotnet_hooks_repo
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello from dotnet!");
- }
- }
-}
diff --git a/testing/resources/dotnet_hooks_csproj_prefix_repo/dotnet_hooks_csproj_prefix_repo.csproj b/testing/resources/dotnet_hooks_csproj_prefix_repo/dotnet_hooks_csproj_prefix_repo.csproj
deleted file mode 100644
index 754b760..0000000
--- a/testing/resources/dotnet_hooks_csproj_prefix_repo/dotnet_hooks_csproj_prefix_repo.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net7.0</TargetFramework>
- <PackAsTool>true</PackAsTool>
- <ToolCommandName>testeroni.tool</ToolCommandName>
- <PackageOutputPath>./nupkg</PackageOutputPath>
- </PropertyGroup>
-</Project>
diff --git a/testing/resources/dotnet_hooks_csproj_repo/.gitignore b/testing/resources/dotnet_hooks_csproj_repo/.gitignore
deleted file mode 100644
index edcd28f..0000000
--- a/testing/resources/dotnet_hooks_csproj_repo/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/
-obj/
-nupkg/
diff --git a/testing/resources/dotnet_hooks_csproj_repo/.pre-commit-hooks.yaml b/testing/resources/dotnet_hooks_csproj_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index 0f514c1..0000000
--- a/testing/resources/dotnet_hooks_csproj_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- id: dotnet-example-hook
- name: dotnet example hook
- entry: testeroni
- language: dotnet
- files: ''
diff --git a/testing/resources/dotnet_hooks_csproj_repo/Program.cs b/testing/resources/dotnet_hooks_csproj_repo/Program.cs
deleted file mode 100644
index 1456e8e..0000000
--- a/testing/resources/dotnet_hooks_csproj_repo/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace dotnet_hooks_repo
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello from dotnet!");
- }
- }
-}
diff --git a/testing/resources/dotnet_hooks_csproj_repo/dotnet_hooks_csproj_repo.csproj b/testing/resources/dotnet_hooks_csproj_repo/dotnet_hooks_csproj_repo.csproj
deleted file mode 100644
index fa9879b..0000000
--- a/testing/resources/dotnet_hooks_csproj_repo/dotnet_hooks_csproj_repo.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net6</TargetFramework>
- <PackAsTool>true</PackAsTool>
- <ToolCommandName>testeroni</ToolCommandName>
- <PackageOutputPath>./nupkg</PackageOutputPath>
- </PropertyGroup>
-</Project>
diff --git a/testing/resources/dotnet_hooks_sln_repo/.gitignore b/testing/resources/dotnet_hooks_sln_repo/.gitignore
deleted file mode 100644
index edcd28f..0000000
--- a/testing/resources/dotnet_hooks_sln_repo/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/
-obj/
-nupkg/
diff --git a/testing/resources/dotnet_hooks_sln_repo/.pre-commit-hooks.yaml b/testing/resources/dotnet_hooks_sln_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index 0f514c1..0000000
--- a/testing/resources/dotnet_hooks_sln_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- id: dotnet-example-hook
- name: dotnet example hook
- entry: testeroni
- language: dotnet
- files: ''
diff --git a/testing/resources/dotnet_hooks_sln_repo/Program.cs b/testing/resources/dotnet_hooks_sln_repo/Program.cs
deleted file mode 100644
index 04ad4e0..0000000
--- a/testing/resources/dotnet_hooks_sln_repo/Program.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace dotnet_hooks_sln_repo
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello from dotnet!");
- }
- }
-}
diff --git a/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.csproj b/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.csproj
deleted file mode 100644
index a4e2d00..0000000
--- a/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>net6</TargetFramework>
- <PackAsTool>true</PackAsTool>
- <ToolCommandName>testeroni</ToolCommandName>
- <PackageOutputPath>./nupkg</PackageOutputPath>
- </PropertyGroup>
-</Project>
diff --git a/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.sln b/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.sln
deleted file mode 100644
index 87d2afb..0000000
--- a/testing/resources/dotnet_hooks_sln_repo/dotnet_hooks_sln_repo.sln
+++ /dev/null
@@ -1,34 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26124.0
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet_hooks_sln_repo", "dotnet_hooks_sln_repo.csproj", "{6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|x64.ActiveCfg = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|x64.Build.0 = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Debug|x86.Build.0 = Debug|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|Any CPU.Build.0 = Release|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|x64.ActiveCfg = Release|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|x64.Build.0 = Release|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|x86.ActiveCfg = Release|Any CPU
- {6568CFDB-6F6F-45A9-932C-8C7DAABC8E56}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
diff --git a/testing/resources/golang_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/golang_hooks_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index 206733b..0000000
--- a/testing/resources/golang_hooks_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- id: golang-hook
- name: golang example hook
- entry: golang-hello-world
- language: golang
- files: ''
diff --git a/testing/resources/golang_hooks_repo/go.mod b/testing/resources/golang_hooks_repo/go.mod
deleted file mode 100644
index f37d4b6..0000000
--- a/testing/resources/golang_hooks_repo/go.mod
+++ /dev/null
@@ -1,5 +0,0 @@
-module golang-hello-world
-
-go 1.18
-
-require github.com/BurntSushi/toml v1.1.0
diff --git a/testing/resources/golang_hooks_repo/go.sum b/testing/resources/golang_hooks_repo/go.sum
deleted file mode 100644
index ec0c385..0000000
--- a/testing/resources/golang_hooks_repo/go.sum
+++ /dev/null
@@ -1,2 +0,0 @@
-github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
-github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
diff --git a/testing/resources/golang_hooks_repo/golang-hello-world/main.go b/testing/resources/golang_hooks_repo/golang-hello-world/main.go
deleted file mode 100644
index 1685743..0000000
--- a/testing/resources/golang_hooks_repo/golang-hello-world/main.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package main
-
-
-import (
- "fmt"
- "runtime"
- "github.com/BurntSushi/toml"
- "os"
-)
-
-type Config struct {
- What string
-}
-
-func main() {
- message := runtime.Version()
- if len(os.Args) > 1 {
- message = os.Args[1]
- }
- var conf Config
- toml.Decode("What = 'world'\n", &conf)
- fmt.Printf("hello %v from %s\n", conf.What, message)
-}
diff --git a/testing/resources/python_venv_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/python_venv_hooks_repo/.pre-commit-hooks.yaml
deleted file mode 100644
index a666ed8..0000000
--- a/testing/resources/python_venv_hooks_repo/.pre-commit-hooks.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-- id: foo
- name: Foo
- entry: foo
- language: python_venv
- files: \.py$
diff --git a/testing/resources/python_venv_hooks_repo/foo.py b/testing/resources/python_venv_hooks_repo/foo.py
deleted file mode 100644
index 40efde3..0000000
--- a/testing/resources/python_venv_hooks_repo/foo.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from __future__ import annotations
-
-import sys
-
-
-def main():
- print(repr(sys.argv[1:]))
- print('Hello World')
- return 0
diff --git a/testing/resources/python_venv_hooks_repo/setup.py b/testing/resources/python_venv_hooks_repo/setup.py
deleted file mode 100644
index cff6cad..0000000
--- a/testing/resources/python_venv_hooks_repo/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
- name='foo',
- version='0.0.0',
- py_modules=['foo'],
- entry_points={'console_scripts': ['foo = foo:main']},
-)
diff --git a/testing/util.py b/testing/util.py
index b6c3804..7c68d0e 100644
--- a/testing/util.py
+++ b/testing/util.py
@@ -6,24 +6,13 @@ import subprocess
import pytest
-from pre_commit.util import CalledProcessError
from pre_commit.util import cmd_output
-from pre_commit.util import cmd_output_b
from testing.auto_namedtuple import auto_namedtuple
TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
-def docker_is_running() -> bool: # pragma: win32 no cover
- try:
- cmd_output_b('docker', 'ps')
- except CalledProcessError: # pragma: no cover
- return False
- else:
- return True
-
-
def get_resource_path(path):
return os.path.join(TESTING_DIR, 'resources', path)
@@ -41,10 +30,6 @@ def cmd_output_mocked_pre_commit_home(
return ret, out.replace('\r\n', '\n'), None
-skipif_cant_run_docker = pytest.mark.skipif(
- os.name == 'nt' or not docker_is_running(),
- reason="Docker isn't running or can't be accessed",
-)
xfailif_windows = pytest.mark.xfail(os.name == 'nt', reason='windows')