I use tox and coverage.py to run tests of my Python project on my continuous build server. I also have a pkg_x package from a provider (not available in PyPI) that I installed with python3.5 setup.py install , which puts it in /usr/lib/python3.5/site-packages . Now I need to make this package available for test code.
My current tox.ini as follows:
[tox] envlist = py35 [testenv] deps = nose coverage commands = coverage run -m nose [] sitepackages = True
and I run the tests as follows:
python3.5 -m tox -- --verbose --with-doctest
This is inefficient - none of the dependency packages listed in my local setup.py (e.g., public stuff like more_itertools ) can be found, although it creates directories like .tox/py35/lib/python3.5/site-packages/more_itertools , which appear to contain the appropriate packages. If I run .tox/py35/bin/python3.5 , sys.path looks like this:
>>> [re.compile('.*\\.tox').sub('.tox', x) for x in sys.path] ['', '.tox/py35/lib64/python35.zip', '.tox/py35/lib64/python3.5', '.tox/py35/lib64/python3.5/plat-linux', '.tox/py35/lib64/python3.5/lib-dynload', '/usr/lib64/python3.5', '/usr/lib/python3.5', '.tox/py35/lib/python3.5/site-packages']
If I delete the line sitepackages = True from my tox.ini , then I get further, in packages like more_itertools , and the rest of the contents in my setup.py dependencies can now be found, but the package provider pkg_x I mentioned above is still I can not find. And sys.path looks like this:
>>> [re.compile('.*\\.tox').sub('.tox', x) for x in sys.path] ['', '.tox/py35/lib64/python35.zip', '.tox/py35/lib64/python3.5', '.tox/py35/lib64/python3.5/plat-linux', '.tox/py35/lib64/python3.5/lib-dynload', '/usr/lib64/python3.5', '/usr/lib/python3.5', '.tox/py35/lib/python3.5/site-packages', '/usr/lib64/python3.5/site-packages', '/usr/lib/python3.5/site-packages']
Anyway .tox/py35/ seems to contain the pkg_x provider package anywhere. And although the /usr/lib/python3.5/site-packages directory is specified when shooting .tox/py35/bin/python3.5 manually, pkg_x not actually found when running the tests.
It looks like sitepackages = True has the opposite effect from what it documented at http://tox.readthedocs.io/en/latest/config.html#confval-sitepackages=True|False , right?
Tips are greatly appreciated!