OMG we're running a hook

This commit is contained in:
Anthony Sottile 2014-03-13 22:12:33 -07:00
parent 47bad120e4
commit 871ab4d72f
11 changed files with 105 additions and 25 deletions

View file

@ -66,6 +66,7 @@ setup(
local.path('__init__.py').write('')
local.path('main.py').write("""
def func():
print 'Hello World'
return 0
""")

View file

View file

@ -0,0 +1,15 @@
import pytest
import pre_commit.constants as C
from pre_commit.languages.all import languages
def test_all_languages_have_repo_setups():
assert set(languages.keys()) == C.SUPPORTED_LANGUAGES
@pytest.mark.parametrize('language', C.SUPPORTED_LANGUAGES)
def test_all_languages_support_interface(language):
assert hasattr(languages[language], 'install_environment')
assert hasattr(languages[language], 'run_hook')

View file

@ -30,7 +30,6 @@ def test_create_repo_in_env(dummy_repo_config, dummy_git_repo):
@pytest.mark.integration
def test_install_python_repo_in_env(python_pre_commit_git_repo, config_for_python_pre_commit_git_repo):
repo = Repository(config_for_python_pre_commit_git_repo)
# TODO: do we need create here?
repo.install()
assert os.path.exists(
@ -43,6 +42,16 @@ def test_install_python_repo_in_env(python_pre_commit_git_repo, config_for_pytho
)
@pytest.mark.integration
def test_run_a_hook_omg(config_for_python_pre_commit_git_repo):
repo = Repository(config_for_python_pre_commit_git_repo)
repo.install()
ret = repo.run_hook('foo', [])
assert ret[0] == 0
assert ret[1] == 'Hello World\n'
@pytest.fixture
def mock_repo_config():
config = {