mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
Add failing test for #229
This commit is contained in:
parent
a875231be3
commit
154d918ff1
1 changed files with 23 additions and 0 deletions
|
|
@ -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
|
@pytest.mark.integration
|
||||||
def test_versioned_python_hook(tmpdir_factory, store):
|
def test_versioned_python_hook(tmpdir_factory, store):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue