mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
commit
2c028f5d41
2 changed files with 23 additions and 1 deletions
|
@ -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']
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue