Remove Manifest, no longer a useful abstraction

This commit is contained in:
Anthony Sottile 2017-10-26 16:08:40 -07:00
parent 71822279ee
commit 84b1ba520d
6 changed files with 38 additions and 90 deletions

View file

@ -1,60 +0,0 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from pre_commit import git
from pre_commit.manifest import Manifest
from testing.fixtures import make_repo
@pytest.yield_fixture
def manifest(store, tempdir_factory):
path = make_repo(tempdir_factory, 'script_hooks_repo')
repo_path = store.clone(path, git.head_sha(path))
yield Manifest(repo_path)
def test_manifest_contents(manifest):
# Should just retrieve the manifest contents
assert manifest.manifest_contents == [{
'always_run': False,
'additional_dependencies': [],
'args': [],
'description': '',
'entry': 'bin/hook.sh',
'exclude': '^$',
'files': '',
'id': 'bash_hook',
'language': 'script',
'language_version': 'default',
'log_file': '',
'minimum_pre_commit_version': '0',
'name': 'Bash hook',
'pass_filenames': True,
'stages': [],
'types': ['file'],
'exclude_types': [],
}]
def test_hooks(manifest):
assert manifest.hooks['bash_hook'] == {
'always_run': False,
'additional_dependencies': [],
'args': [],
'description': '',
'entry': 'bin/hook.sh',
'exclude': '^$',
'files': '',
'id': 'bash_hook',
'language': 'script',
'language_version': 'default',
'log_file': '',
'minimum_pre_commit_version': '0',
'name': 'Bash hook',
'pass_filenames': True,
'stages': [],
'types': ['file'],
'exclude_types': [],
}

View file

@ -746,3 +746,29 @@ def test_versions_ok(tempdir_factory, store, version):
config = make_config_from_repo(path)
# Should succeed
Repository.create(config, store).require_installed()
def test_manifest_hooks(tempdir_factory, store):
path = make_repo(tempdir_factory, 'script_hooks_repo')
config = make_config_from_repo(path)
repo = Repository.create(config, store)
assert repo.manifest_hooks['bash_hook'] == {
'always_run': False,
'additional_dependencies': [],
'args': [],
'description': '',
'entry': 'bin/hook.sh',
'exclude': '^$',
'files': '',
'id': 'bash_hook',
'language': 'script',
'language_version': 'default',
'log_file': '',
'minimum_pre_commit_version': '0',
'name': 'Bash hook',
'pass_filenames': True,
'stages': [],
'types': ['file'],
'exclude_types': [],
}