mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 10:01:46 +04:00
Fix tests
This commit is contained in:
parent
9a8fb17070
commit
e21cd01a70
4 changed files with 12 additions and 6 deletions
|
|
@ -70,7 +70,6 @@ def validate_config_extra(config):
|
|||
raise InvalidConfigError(
|
||||
'"sha" property provided for local hooks'
|
||||
)
|
||||
repo['sha'] = 'local'
|
||||
elif 'sha' not in repo:
|
||||
raise InvalidConfigError(
|
||||
'Missing "sha" field for repository {}'.format(repo['repo'])
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import pkg_resources
|
|||
from cached_property import cached_property
|
||||
|
||||
from pre_commit import five
|
||||
from pre_commit.clientlib.validate_config import _LOCAL_HOOKS_MAGIC_REPO_STRING
|
||||
from pre_commit.clientlib.validate_config import is_local_hooks
|
||||
from pre_commit.clientlib.validate_manifest import MANIFEST_JSON_SCHEMA
|
||||
from pre_commit.jsonschema_extensions import apply_defaults
|
||||
|
|
@ -39,7 +40,10 @@ class Repository(object):
|
|||
@classmethod
|
||||
def create(cls, config, store, owner):
|
||||
repo_path_getter = store.get_repo_path_getter(
|
||||
config['repo'], config['sha'], owner
|
||||
config['repo'],
|
||||
_LOCAL_HOOKS_MAGIC_REPO_STRING if
|
||||
is_local_hooks(config) else config['sha'],
|
||||
owner,
|
||||
)
|
||||
if is_local_hooks(config):
|
||||
return LocalRepository(config, repo_path_getter)
|
||||
|
|
|
|||
|
|
@ -11,10 +11,15 @@ from pre_commit.languages.all import languages
|
|||
@pytest.mark.parametrize('language', all_languages)
|
||||
def test_install_environment_argspec(language):
|
||||
expected_argspec = inspect.ArgSpec(
|
||||
args=['repo_cmd_runner', 'version', 'additional_dependencies'],
|
||||
args=[
|
||||
'repo_cmd_runner',
|
||||
'version',
|
||||
'additional_dependencies',
|
||||
'is_local_hook',
|
||||
],
|
||||
varargs=None,
|
||||
keywords=None,
|
||||
defaults=('default', ()),
|
||||
defaults=('default', (), False),
|
||||
)
|
||||
argspec = inspect.getargspec(languages[language].install_environment)
|
||||
assert argspec == expected_argspec
|
||||
|
|
|
|||
|
|
@ -580,7 +580,6 @@ def test_install_local_ruby_hook(
|
|||
): # pragma: no cover (non-windows)
|
||||
config = config_with_local_hooks('ruby')
|
||||
config['hooks'][0]['additional_dependencies'] = ['thread_safe']
|
||||
validate_config_extra([config])
|
||||
repo = Repository.create(config, store, '/path/to/repo/')
|
||||
repo.require_installed()
|
||||
with ruby.in_env(repo.cmd_runner, 'default'):
|
||||
|
|
@ -594,7 +593,6 @@ def test_install_local_python_hook(
|
|||
): # pragma: no cover (non-windows)
|
||||
config = config_with_local_hooks('python')
|
||||
config['hooks'][0]['additional_dependencies'] = ['mccabe']
|
||||
validate_config_extra([config])
|
||||
repo = Repository.create(config, store, '/path/to/repo/')
|
||||
repo.require_installed()
|
||||
with python.in_env(repo.cmd_runner, 'default'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue