Implement default_language_version

This commit is contained in:
Anthony Sottile 2019-01-05 13:01:42 -08:00
parent 579b05e424
commit d3b5a41830
23 changed files with 150 additions and 103 deletions

View file

@ -7,7 +7,7 @@ from pre_commit.clientlib import check_type_tag
from pre_commit.clientlib import CONFIG_HOOK_DICT
from pre_commit.clientlib import CONFIG_REPO_DICT
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import is_local_repo
from pre_commit.clientlib import DEFAULT_LANGUAGE_VERSION
from pre_commit.clientlib import MANIFEST_SCHEMA
from pre_commit.clientlib import MigrateShaToRev
from pre_commit.clientlib import validate_config_main
@ -30,10 +30,6 @@ def test_check_type_tag_failures(value):
check_type_tag(value)
def test_is_local_repo():
assert is_local_repo({'repo': 'local'})
@pytest.mark.parametrize(
('args', 'expected_output'),
(
@ -250,6 +246,20 @@ def test_migrate_to_sha_ok():
{'repo': 'meta', 'hooks': [{'id': 'identity', 'name': False}]},
),
)
def test_meta_hook_invalid_id(config_repo):
def test_meta_hook_invalid(config_repo):
with pytest.raises(cfgv.ValidationError):
cfgv.validate(config_repo, CONFIG_REPO_DICT)
@pytest.mark.parametrize(
'mapping',
(
# invalid language key
{'pony': '1.0'},
# not a string for version
{'python': 3},
),
)
def test_default_language_version_invalid(mapping):
with pytest.raises(cfgv.ValidationError):
cfgv.validate(mapping, DEFAULT_LANGUAGE_VERSION)