pre-commit-hooks/tests/readme_test.py

13 lines
375 B
Python
Raw Normal View History

from __future__ import annotations
2019-03-11 06:24:38 +08:00
from pre_commit_hooks.check_yaml import yaml
2015-01-19 01:48:14 +08:00
def test_readme_contains_all_hooks():
2020-02-06 03:10:42 +08:00
with open('README.md', encoding='UTF-8') as f:
2018-03-26 08:12:49 +08:00
readme_contents = f.read()
2020-02-06 03:10:42 +08:00
with open('.pre-commit-hooks.yaml', encoding='UTF-8') as f:
2018-03-26 08:12:49 +08:00
hooks = yaml.load(f)
2015-01-19 01:48:14 +08:00
for hook in hooks:
2020-02-06 03:10:42 +08:00
assert f'`{hook["id"]}`' in readme_contents