Skip to content

Commit 1aa7b59

Browse files
Merge pull request #853 from adamtheturtle/custom-linter
Add meta test for __init__ file
2 parents ec6655a + 5119d39 commit 1aa7b59

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_meta.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Tests for this repository.
3+
"""
4+
5+
from pathlib import Path
6+
7+
8+
def test_init_files() -> None:
9+
"""
10+
``__init__`` files exist where they should do.
11+
12+
If ``__init__`` files are missing, linters may not run on all files that
13+
they should run on.
14+
"""
15+
directories = (Path('src'), Path('tests'))
16+
17+
for directory in directories:
18+
files = directory.glob('**/*.py')
19+
for python_file in files:
20+
parent = python_file.parent
21+
expected_init = parent / '__init__.py'
22+
assert expected_init.exists()

0 commit comments

Comments
 (0)