Pass VIRTUAL_ENV environment variable to commands executed in a virtualenv (#245)
Pass VIRTUAL_ENV environment variable to commands executed in a virtualenv (#245)

Add the VIRTUAL_ENV variable to the process environment of commands
executed in a nox session. The value of this variable contains the
location of the virtualenv created by nox. More specifically, add the
variable to the `env` attribute of `VirtualEnv` instances.

Some commands rely on the presence of the VIRTUAL_ENV variable in their
environment to detect that they are running in a virtualenv. In
particular, poetry and pipenv will only install packages into the
virtualenv if its location is passed to them via this variable. Without
that variable, these commands will create their own virtualenv for the
project, breaking session isolation.

The VIRTUAL_ENV variable is usually set in the user's shell by the
bin/activate scripts provided with a virtualenv. In the case of nox,
commands run in a session are not executed within a shell. So the
variable needs to be provided to the command by nox itself.
jonparrott/nox