5

I have a tox.ini file

[testenv:py27]
deps= -r{toxinidir}/requirements.txt
setenv =
    PYTHONPATH = {toxinidir}{:}{toxinidir}/helpers

I ran the command tox and the virtualenv was created inside .tox/py27

When I activate the py27 environment

cd .tox/py7/bin
source activate 
py27 $ echo $PYTHONPATH < gives null>

PYTHONPATH is empty though the tox.ini has setenv with PYTHONPATH explicity set

Why is the PYTHONPATH setting itself to empty ?

Varunkumar Manohar
  • 887
  • 3
  • 11
  • 29

1 Answers1

3

Are you expecting tox to modify the activate script like described here?

If you want to change the PYTHONPATH used in a virtualenv, you can add the following line to your virtualenv's bin/activate file:

export PYTHONPATH="/the/path/you/want"

This way, the new PYTHONPATH will be set each time you use this virtualenv.

If yes: tox does not do anything like that - it creates a vanilla virtualenv (or venv if tox-venv is installed).

So, what is defined in setenv only happens, when you run the tox environment (see code).

Oliver Bestwalter
  • 5,219
  • 33
  • 47