Merge pull request #1514 from astronouth7303/vox-fix-path

Fix #1513
This commit is contained in:
Anthony Scopatz 2016-07-30 01:32:18 -07:00 committed by GitHub
commit 2c028f5d41
2 changed files with 23 additions and 1 deletions

View file

@ -43,3 +43,25 @@ def test_activate(xonsh_builtins, tmpdir):
assert xonsh_builtins.__xonsh_env__['VIRTUAL_ENV'] == vox['spam'].env
vox.deactivate()
assert 'VIRTUAL_ENV' not in xonsh_builtins.__xonsh_env__
@skip_if_on_conda
def test_path(xonsh_builtins, tmpdir):
"""
Test to make sure Vox properly activates and deactivates by examining $PATH
"""
xonsh_builtins.__xonsh_env__['VIRTUALENV_HOME'] = str(tmpdir)
# I consider the case that the user doesn't have a PATH set to be unreasonable
xonsh_builtins.__xonsh_env__.setdefault('PATH', [])
oldpath = list(xonsh_builtins.__xonsh_env__['PATH'])
vox = Vox()
vox.create('eggs')
vox.activate('eggs')
assert oldpath != xonsh_builtins.__xonsh_env__['PATH']
vox.deactivate()
assert oldpath == xonsh_builtins.__xonsh_env__['PATH']

View file

@ -178,7 +178,7 @@ class Vox(collections.abc.Mapping):
if 'VIRTUAL_ENV' in env:
self.deactivate()
type(self).oldvars = {'PATH': env['PATH']}
type(self).oldvars = {'PATH': list(env['PATH'])}
env['PATH'].insert(0, bin_path)
env['VIRTUAL_ENV'] = env_path
if 'PYTHONHOME' in env: