diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-27 10:32:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-27 10:32:18 +0000 |
commit | a75e61fbe483eb1f3bbfb2d61d7c15615f56172b (patch) | |
tree | 2200a67ca0cbe0c8091c69a447c70c3b0ca0a79c /testing/language_helpers.py | |
parent | Adding upstream version 3.0.4. (diff) | |
download | pre-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 'testing/language_helpers.py')
-rw-r--r-- | testing/language_helpers.py | 15 |
1 files changed, 9 insertions, 6 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 |