-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
18 lines (14 loc) · 598 Bytes
/
test.py
File metadata and controls
18 lines (14 loc) · 598 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Some extra sanity checks for the CI."""
import sys
import re
from pathlib import Path
NEWS = Path(__file__).parent / "content" / "news"
for root, dirs, files in NEWS.walk():
for name in files:
f = root / name
m = re.search(r"^Tags: (?P<tags>.*)$", f.read_text(), re.MULTILINE)
# Tags header overrides the path tag, so enforce that the path tag is
# included in the header for consistency.
if m and f.parent.name not in m.group("tags"):
print(f"Tag from path must be repeated in Tags metadata: {f}")
sys.exit(1)