Support for conda as a language

This commit is contained in:
Uwe L. Korn 2019-12-02 15:18:54 +01:00 committed by Anthony Sottile
parent 6850c27dd6
commit 4ff23b4eab
8 changed files with 137 additions and 1 deletions

View file

@ -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',