OpenStack uses pbr and tox together all the time, but they wrote pbr. Further, I wouldn't recommend it but it does have some nice features so I wouldn't strongly advise against it

Sent from my phone with my typo-happy thumbs. Please excuse my brevity

On Wed, May 2, 2018, 15:58 Oliver Bestwalter <oliver@bestwalter.de> wrote:
Hello Fred,

you are entering this on the deep end and there is a lot of things that might yield interesting results, so you are definitely not doinng something ridiculous, but a lot of unusual things and some things that give me the feeling that the tox docs need some serious TLC :)

Just shooting a few things from the hip here without having time to look in more detail, but I will try to give you some pointers:

The main red flag for me is pbr. Never having used it myself - I have no idea what it is doing exactly and how that might interfer with tox and "normal" virtualenvs, but I can remember dimly reading a discussion where someone struggled with getting this to work together with tox, so you should maybe first try to get some simpler project working without using pbr and then work your way up. The pbr folks use tox themselves, so if you are still running into problems them, mabye they might be better suited to help you.

Now for some more obvious things:

> install_command = pip install -r tox-requirements.txt {opts} {packages}

should be:

deps = -rtox-requirements.txt

or even simper: listing the packages directly in tox deps instead of a special tox requirements file. Or you csan have the test deps as extras or tests_require as part of your setup.py. Read up about it here:

* https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
simplest way for now would be

deps =
    pytest
    flexmock
    # or whatever stuff you only need to run tests with in tox envs

Then:

> basepython = /op/...all kind of interesting interpreters

basepython chooses the python that the venv should be built with, so you might have a different expectation here and I am not even quite sure what is supposed to happen here, as I never have played around with interesting basepython settings yet. So. Have a look at http://tox.readthedocs.io/en/latest/config.html#confval-basepython=NAME-OR-PATH and decide for yourself and observe with tox -vvv what exactly is happening.

Having the indexes in the requirements file is another interesting setting that I personally have never used. You can set the index also in tox, so maybe you want to experiment with that: http://tox.readthedocs.io/en/latest/config.html#confval-indexserver

Cheers,
Oliver

On Wed, 2 May 2018 at 19:51 Fred Drake <fred@fdrake.net> wrote:
So for years I worked in a buildout shop, and now I'm in a
Debian-packages-are-good-enough shop, and I'm looking to improve that
situation.

For some of my libraries at work, I want to get cross-version testing
straightened out a bit, and tox seems to be the state of the art.
(Yes, Python 2.7 is part of the mix, but getting past that means
getting library tests running on Python 3 before we tackle
applications.)

I'm using a fairly simple tox.ini file, defining three environments
built on top of "clean" Python installations:

------------------------
[tox]
envlist = py27,py35,py36

[testenv]
commands =
    python -m unittest discover -p *tests.py -p *test.py

install_command = pip install -r tox-requirements.txt {opts} {packages}

[testenv:py27]
basepython = /opt/kt-python27/bin/python2

[testenv:py35]
basepython = /opt/kt-python35/bin/python3

[testenv:py36]
basepython = /opt/kt-python36/bin/python3
------------------------

The tox-requirements.txt is pretty minimal, and doesn't do anything
particularly interesting, but does include options to use a local
DevPI server instead of PyPI.

My project has a venv based on my clean python 3.6 installation.  tox
is installed into the venv.

When running bin/tox, tox creates an sdist for my library package,
then creates the venvs and installs my package into them.  When nearly
complete, the installation fails because of an attempt to write a
script into the system /usr/bin, which shouldn't happen in the venv:

------------------------
GLOB sdist-make: /home/fdrake/p/ks3.mediaflux/setup.py
py27 create: /home/fdrake/p/ks3.mediaflux/.tox/py27
py27 inst: /home/fdrake/p/ks3.mediaflux/.tox/dist/ks3.mediaflux-3.5.0.zip
ERROR: invocation failed (exit code 1), logfile:
/home/fdrake/p/ks3.mediaflux/.tox/py27/log/py27-1.log
ERROR: actionid: py27
msg: installpkg
cmdargs: ['/home/fdrake/p/ks3.mediaflux/.tox/py27/bin/pip', 'install',
'-r', 'tox-requirements.txt',
'/home/fdrake/p/ks3.mediaflux/.tox/dist/ks3.mediaflux-3.5.0.zip']

Looking in indexes: http://devpi/root/pypi/+simple/,
http://devpi/keeper/keepertech/+simple/
Processing ./.tox/dist/ks3.mediaflux-3.5.0.zip
...
Successfully built ks3.mediaflux
Installing collected packages: six, funcsigs, pbr, mock, idna,
chardet, certifi, urllib3, requests, kt.testing, zc.lockfile,
kt.common, pytz, itsdangerous, Werkzeug, click, MarkupSafe, Jinja2,
Flask, aniso8601, flask-RESTful, netaddr, kt.restful, ks3.mediaflux
Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied: '/usr/bin/pbr'
Consider using the `--user` option or check the permissions.
------------------------

If I manually cd into .tox/py27 and running bin/pip install -r
../../tox-requirements.txt succeeds, and there's no attempt to write
into /usr/bin/.  Doing that for each of the environments allows tox to
run the tests and produce the expected summary.

At this point, I presume I've done some ridiculous in my configuration
somewhere.  Is there something obvious to others that I'm just missing
because I'm not familiar with the tools?

Thanks!


  -Fred

--
Fred L. Drake, Jr.    <fred at fdrake.net>
"A storm broke loose in my mind."  --Albert Einstein
_______________________________________________
tox-dev mailing list
tox-dev@python.org
https://mail.python.org/mm3/mailman3/lists/tox-dev.python.org/
_______________________________________________
tox-dev mailing list
tox-dev@python.org
https://mail.python.org/mm3/mailman3/lists/tox-dev.python.org/