Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b98b39

Browse files
committed
language_version works for python.
1 parent a7ab9b2 commit 4b98b39

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

pre_commit/languages/python.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def install_environment(repo_cmd_runner, version='default'):
2323

2424
# Install a virtualenv
2525
with clean_path_on_failure(repo_cmd_runner.path(ENVIRONMENT_DIR)):
26-
repo_cmd_runner.run(['virtualenv', '{{prefix}}{0}'.format(ENVIRONMENT_DIR)])
26+
venv_cmd = ['virtualenv', '{{prefix}}{0}'.format(ENVIRONMENT_DIR)]
27+
if version != 'default':
28+
venv_cmd.extend(['-p', version])
29+
repo_cmd_runner.run(venv_cmd)
2730
with in_env(repo_cmd_runner) as env:
2831
env.run('cd {prefix} && pip install .')
2932

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
'plumbum',
3737
'pyyaml',
3838
'simplejson',
39+
'virtualenv',
3940
],
4041
entry_points={
4142
'console_scripts': [

tests/repository_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def test_run_a_python_hook(config_for_python_hooks_repo, store):
2424
assert ret[1] == "['/dev/null']\nHello World\n"
2525

2626

27-
@pytest.mark.xfail
2827
@pytest.mark.integration
2928
def test_run_versioned_hook(config_for_python3_hooks_repo, store):
3029
repo = Repository.create(config_for_python3_hooks_repo, store)

0 commit comments

Comments
 (0)