mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
Add hook for checking python modules
This commit is contained in:
parent
76c604c9fb
commit
1722bd0ce2
5 changed files with 71 additions and 0 deletions
13
tests/check_python_modules_test.py
Normal file
13
tests/check_python_modules_test.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import pytest
|
||||
|
||||
from pre_commit_hooks.check_python_modules import main
|
||||
|
||||
|
||||
@pytest.mark.parametrize('has_init', (True, False))
|
||||
def test_main(tmpdir, has_init):
|
||||
if has_init:
|
||||
tmpdir.join('__init__.py').ensure()
|
||||
path = tmpdir.join('thing.py').ensure()
|
||||
|
||||
expected = 0 if has_init else 1
|
||||
assert main((path.strpath,)) == expected
|
||||
Loading…
Add table
Add a link
Reference in a new issue