mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-12 20:10:21 -06:00
Add failing test for #229
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user