testenv:cutom does not respect envlist?

Issue #303 on hold
tbaldman NA created an issue

Hello,

I have been scratching my head over this. Consider the following tox.ini file:

[tox]
envlist = py34

[testenv]
setenv =
    DJANGO_SETTINGS_MODULE={env:DJANGO_SETTINGS_MODULE_TEST:snom_cms.settings.base}
    PYTHONPATH = {toxinidir}/snom_cms

[testenv:teamcity]
deps =
    -r{toxinidir}/REQUIREMENTS
    {[testenv]deps}
    wheel
    teamcity-messages

invoking this:

tox

creates a python3.4 environment as expected.

However, invoking this:

tox -e teamcity

Creates a 2.7 instead.

Now, I could fix it with:

[testenv:teamcity]
basepython = python3.4
deps =

but I don't understand how this can be. More to the point, setting basepython for the testenv like this:

[testenv]
basepython = python3.4
setenv =
    DJANGO_SETTINGS_MODULE={env:DJANGO_SETTINGS_MODULE_TEST:snom_cms.settings.base}
    PYTHONPATH = {toxinidir}/snom_cms

will solve the issue as well (but why?), but when I try to be more exact for multiple pythons like this:

[testenv]
basepython = 
    py34: python3.4
    py26: python2.7

I end up with the following exception.

teamcity: InterpreterNotFound:

So, my question (or possibly bug report), is under which conditions this may happen and how to go around that.

...

Comments (3)

  1. Sachi King

    When you call 'tox -e teamcity' you're overriding the envlist. The envlist is there so you can call 'tox' and it will run a default set.

    So you're calling tox with an environment of py34, which tox will use as a factor, and that matches to a factor in basepython, and sets it to python3.4. When you call just 'teamcity' basepython does not match a factor and it uses your systems default python interpreter, 'python'.

    With your initial tox.ini, you can run 'tox -e teamcity-py34' and it will do what you want, or you can change your basepython to look similar to the following and it will default to python3.4.

    [testenv]
    basepython = 
        py34: python3.4
        py27: python2.7
        python3.4
    
  2. Log in to comment