Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ac2ba0

Browse files
committed
Make local hooks work
1 parent 23fe0be commit 5ac2ba0

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "__fake_crate"
3+
version = "0.0.0"
4+
5+
[[bin]]
6+
name = "__fake_cmd"
7+
path = "main.rs"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}

tests/repository_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,24 @@ def test_local_golang_additional_dependencies(store):
604604
assert _norm_out(ret[1]) == b"Hello, Go examples!\n"
605605

606606

607+
def test_local_rust_additional_dependencies(store):
608+
config = {
609+
'repo': 'local',
610+
'hooks': [{
611+
'id': 'hello',
612+
'name': 'hello',
613+
'entry': 'hello',
614+
'language': 'rust',
615+
'additional_dependencies': ['cli:hello-cli:0.2.2'],
616+
}],
617+
}
618+
repo = Repository.create(config, store)
619+
(_, hook), = repo.hooks
620+
ret = repo.run_hook(hook, ())
621+
assert ret[0] == 0
622+
assert _norm_out(ret[1]) == b"Hello World!\n"
623+
624+
607625
def test_reinstall(tempdir_factory, store, log_info_mock):
608626
path = make_repo(tempdir_factory, 'python_hooks_repo')
609627
config = make_config_from_repo(path)

0 commit comments

Comments
 (0)