mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Support for conda as a language
This commit is contained in:
parent
6850c27dd6
commit
4ff23b4eab
8 changed files with 137 additions and 1 deletions
|
|
@ -79,6 +79,46 @@ def _test_hook_repo(
|
|||
assert _norm_out(out) == expected
|
||||
|
||||
|
||||
def test_conda_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'conda_hooks_repo',
|
||||
'sys-exec', [os.devnull],
|
||||
b'conda-default\n',
|
||||
)
|
||||
|
||||
|
||||
def test_conda_with_additional_dependencies_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'conda_hooks_repo',
|
||||
'additional-deps', [os.devnull],
|
||||
b'OK\n',
|
||||
config_kwargs={
|
||||
'hooks': [{
|
||||
'id': 'additional-deps',
|
||||
'args': ['-c', 'import mccabe; print("OK")'],
|
||||
'additional_dependencies': ['mccabe'],
|
||||
}],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_local_conda_additional_dependencies(store):
|
||||
config = {
|
||||
'repo': 'local',
|
||||
'hooks': [{
|
||||
'id': 'local-conda',
|
||||
'name': 'local-conda',
|
||||
'entry': 'python',
|
||||
'language': 'conda',
|
||||
'args': ['-c', 'import mccabe; print("OK")'],
|
||||
'additional_dependencies': ['mccabe'],
|
||||
}],
|
||||
}
|
||||
ret, out = _get_hook(config, store, 'local-conda').run((), color=False)
|
||||
assert ret == 0
|
||||
assert _norm_out(out) == b'OK\n'
|
||||
|
||||
|
||||
def test_python_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'python_hooks_repo',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue