Merge pull request #427 from pre-commit/setup_cfg_issue_425

Allow virtualenv creation with strange setup.cfg.  Resolves #425
This commit is contained in:
Anthony Sottile
2016-11-07 11:58:22 -08:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ def install_environment(
venv_cmd.extend(['-p', norm_version(version)])
else:
venv_cmd.extend(['-p', os.path.realpath(sys.executable)])
repo_cmd_runner.run(venv_cmd)
repo_cmd_runner.run(venv_cmd, cwd='/')
with in_env(repo_cmd_runner, version):
helpers.run_setup_cmd(
repo_cmd_runner,

View File

@@ -81,6 +81,20 @@ def test_python_hook_args_with_spaces(tempdir_factory, store):
)
@pytest.mark.integration
def test_python_hook_weird_setup_cfg(tempdir_factory, store):
path = git_dir(tempdir_factory)
with cwd(path):
with io.open('setup.cfg', 'w') as setup_cfg:
setup_cfg.write('[install]\ninstall_scripts=/usr/sbin\n')
_test_hook_repo(
tempdir_factory, store, 'python_hooks_repo',
'foo', [os.devnull],
b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n"
)
@pytest.mark.integration
def test_switch_language_versions_doesnt_clobber(tempdir_factory, store):
# We're using the python3 repo because it prints the python version