Merge pull request #2729 from pre-commit/rust-tests

test rust directly
This commit is contained in:
Anthony Sottile 2023-01-29 19:00:09 -05:00 committed by GitHub
commit 77b4ea38ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 128 deletions

View file

@ -3,7 +3,6 @@ from __future__ import annotations
import os
from typing import Sequence
import pre_commit.constants as C
from pre_commit.languages.all import Language
from pre_commit.prefix import Prefix
@ -14,11 +13,12 @@ def run_language(
exe: str,
args: Sequence[str] = (),
file_args: Sequence[str] = (),
version: str = C.DEFAULT,
version: str | None = None,
deps: Sequence[str] = (),
is_local: bool = False,
) -> tuple[int, bytes]:
prefix = Prefix(str(path))
version = version or language.get_default_version()
language.install_environment(prefix, version, deps)
with language.in_env(prefix, version):

View file

@ -1,5 +0,0 @@
- id: rust-hook
name: rust example hook
entry: rust-hello-world
language: rust
files: ''

View file

@ -1,3 +0,0 @@
[[package]]
name = "rust-hello-world"
version = "0.1.0"

View file

@ -1,3 +0,0 @@
[package]
name = "rust-hello-world"
version = "0.1.0"

View file

@ -1,3 +0,0 @@
fn main() {
println!("hello world");
}