mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Make local hooks work
This commit is contained in:
parent
23fe0be286
commit
5ac2ba0f7b
3 changed files with 26 additions and 0 deletions
7
pre_commit/resources/empty_template/Cargo.toml
Normal file
7
pre_commit/resources/empty_template/Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "__fake_crate"
|
||||||
|
version = "0.0.0"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "__fake_cmd"
|
||||||
|
path = "main.rs"
|
||||||
1
pre_commit/resources/empty_template/main.rs
Normal file
1
pre_commit/resources/empty_template/main.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
fn main() {}
|
||||||
|
|
@ -604,6 +604,24 @@ def test_local_golang_additional_dependencies(store):
|
||||||
assert _norm_out(ret[1]) == b"Hello, Go examples!\n"
|
assert _norm_out(ret[1]) == b"Hello, Go examples!\n"
|
||||||
|
|
||||||
|
|
||||||
|
def test_local_rust_additional_dependencies(store):
|
||||||
|
config = {
|
||||||
|
'repo': 'local',
|
||||||
|
'hooks': [{
|
||||||
|
'id': 'hello',
|
||||||
|
'name': 'hello',
|
||||||
|
'entry': 'hello',
|
||||||
|
'language': 'rust',
|
||||||
|
'additional_dependencies': ['cli:hello-cli:0.2.2'],
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
repo = Repository.create(config, store)
|
||||||
|
(_, hook), = repo.hooks
|
||||||
|
ret = repo.run_hook(hook, ())
|
||||||
|
assert ret[0] == 0
|
||||||
|
assert _norm_out(ret[1]) == b"Hello World!\n"
|
||||||
|
|
||||||
|
|
||||||
def test_reinstall(tempdir_factory, store, log_info_mock):
|
def test_reinstall(tempdir_factory, store, log_info_mock):
|
||||||
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
||||||
config = make_config_from_repo(path)
|
config = make_config_from_repo(path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue