mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
additional_dependencies support for golang hooks
This commit is contained in:
parent
cc1eac46e4
commit
84ba1fd0c2
2 changed files with 22 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ from pre_commit import parse_shebang
|
|||
from pre_commit.clientlib.validate_config import CONFIG_JSON_SCHEMA
|
||||
from pre_commit.clientlib.validate_config import validate_config_extra
|
||||
from pre_commit.jsonschema_extensions import apply_defaults
|
||||
from pre_commit.languages import golang
|
||||
from pre_commit.languages import helpers
|
||||
from pre_commit.languages import node
|
||||
from pre_commit.languages import pcre
|
||||
|
|
@ -542,6 +543,25 @@ def test_additional_node_dependencies_installed(
|
|||
assert 'lodash' in output
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_additional_golang_dependencies_installed(
|
||||
tempdir_factory, store,
|
||||
):
|
||||
path = make_repo(tempdir_factory, 'golang_hooks_repo')
|
||||
config = make_config_from_repo(path)
|
||||
# A small go package
|
||||
config['hooks'][0]['additional_dependencies'] = ['github.com/firba1/tpol']
|
||||
repo = Repository.create(config, store)
|
||||
repo.require_installed()
|
||||
with golang.in_env(repo.cmd_runner):
|
||||
gopath = repo.cmd_runner.path(helpers.environment_dir(
|
||||
golang.ENVIRONMENT_DIR, 'default',
|
||||
))
|
||||
env = dict(os.environ, GOPATH=gopath)
|
||||
output = cmd_output('go', 'list', '...', env=env)[1]
|
||||
assert 'github.com/firba1/tpol' in output
|
||||
|
||||
|
||||
def test_reinstall(tempdir_factory, store, log_info_mock):
|
||||
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
||||
config = make_config_from_repo(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue