[TIP] Tox: An environment using sys.executable as the Python interpreter

Paul Moore p.f.moore at gmail.com
Wed Dec 2 02:32:35 PST 2015


Running tox under CI (travis or Appveyor) there's a common approach
that I see which is to set TOXENV for each test you want to run. While
that's mostly fine, it does rely on either there being a default tox
environment (py35 or similar) that does what you want, or hard-coding
the CI system's Python location(s) in tox.ini.

Appveyor includes two versions of most Python interpreters, 32 and 64
bit. But tox doesn't include default environments corresponding to
both of these.

What I'd like to be able to do is to have an environment that is
"whatever Python I used to invoke tox" - but I don't see anything like
that. I tried putting the complete path to the Python interpreter in
TOXENV, but that gave me "unknown environment" :-(

The objective is to have a tox.ini that has nothing hard coded in it
that refers to the CI environment, but which can test with whatever
version of Python I select. It seems like this should be easy, but I'm
struggling to find a clean way of doing it.

Can anyone help?
Thanks,
Paul



More information about the testing-in-python mailing list