Add hook for checking python modules

This commit is contained in:
Jonathan Como 2019-02-16 14:15:07 -08:00
parent 76c604c9fb
commit 1722bd0ce2
5 changed files with 71 additions and 0 deletions

View 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