forked from pre-commit/pre-commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanifest_test.py
More file actions
47 lines (39 loc) · 1.2 KB
/
manifest_test.py
File metadata and controls
47 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from pre_commit.manifest import Manifest
from testing.fixtures import make_repo
from testing.util import get_head_sha
@pytest.yield_fixture
def manifest(store, tempdir_factory):
path = make_repo(tempdir_factory, 'script_hooks_repo')
head_sha = get_head_sha(path)
repo_path_getter = store.get_repo_path_getter(path, head_sha)
yield Manifest(repo_path_getter)
def test_manifest_contents(manifest):
# Should just retrieve the manifest contents
assert manifest.manifest_contents == [{
'args': [],
'description': '',
'entry': 'bin/hook.sh',
'exclude': '^$',
'files': '',
'id': 'bash_hook',
'language': 'script',
'language_version': 'default',
'name': 'Bash hook',
'stages': [],
}]
def test_hooks(manifest):
assert manifest.hooks['bash_hook'] == {
'args': [],
'description': '',
'entry': 'bin/hook.sh',
'exclude': '^$',
'files': '',
'id': 'bash_hook',
'language': 'script',
'language_version': 'default',
'name': 'Bash hook',
'stages': [],
}