Add failing test for #229

This commit is contained in:
Anthony Sottile
2015-05-16 18:37:58 -04:00
parent a875231be3
commit 154d918ff1

View File

@@ -71,6 +71,29 @@ def test_python_hook_args_with_spaces(tmpdir_factory, store):
)
@pytest.mark.integration
def test_switch_language_versions_doesnt_clobber(tmpdir_factory, store):
# We're using the python3 repo because it prints the python version
path = make_repo(tmpdir_factory, 'python3_hooks_repo')
def run_on_version(version, expected_output):
config = make_config_from_repo(
path, hooks=[{'id': 'python3-hook', 'language_version': version}],
)
repo = Repository.create(config, store)
hook_dict, = [
hook
for repo_hook_id, hook in repo.hooks
if repo_hook_id == 'python3-hook'
]
ret = repo.run_hook(hook_dict, [])
assert ret[0] == 0
assert ret[1].replace('\r\n', '\n') == expected_output
run_on_version('python3.4', '3.4\n[]\nHello World\n')
run_on_version('python3.3', '3.3\n[]\nHello World\n')
@pytest.mark.integration
def test_versioned_python_hook(tmpdir_factory, store):
_test_hook_repo(