Skip to content

Null generated environment settings #418

Closed
@warsaw

Description

@warsaw

I could have sworn I reported this before, but I can't find it. Maybe I only mentioned it on the mailing list, or described it differently on the old Bitbucket tracker. Anyway...

Let's say I want the following environments:

  • Python 3.4, 3.5, 3.6
  • Python 3.4, 3.5, 3.6 with coverage
  • Python 3.4, 3.5, 3.6 with diffcov

Currently I have to specify them like this:

[tox]
envlist = {py34,py35,py36}-{cov,nocov,diffcov},qa,docs

[testenv]
commands =
    nocov: python -m nose2 -v {posargs}
    {cov,diffcov}: python -m coverage run {[coverage]rc} -m nose2 -v
    {cov,diffcov}: python -m coverage combine {[coverage]rc}
    cov: python -m coverage html {[coverage]rc}
    cov: python -m coverage report -m {[coverage]rc} --fail-under=100
    diffcov: python -m coverage xml {[coverage]rc}
    diffcov: diff-cover coverage.xml --html-report diffcov.html
    diffcov: diff-cover coverage.xml --fail-under=100

And I have to run a "no coverage Python 3.5" test like this: tox -e py35-nocov

But what I'd really like to do is to say tox -e py35 for the "no coverage" case. However I can't do this:

[tox]
envlist = {py34,py35,py36}{,-cov,-diffcov},qa,docs
recreate = True
skip_missing_interpreters = True

[testenv]
commands =
    python -m nose2 -v {posargs}
    {cov,diffcov}: python -m coverage run {[coverage]rc} -m nose2 -v
    {cov,diffcov}: python -m coverage combine {[coverage]rc}
    cov: python -m coverage html {[coverage]rc}
    cov: python -m coverage report -m {[coverage]rc} --fail-under=100
    diffcov: python -m coverage xml {[coverage]rc}
    diffcov: diff-cover coverage.xml --html-report diffcov.html
    diffcov: diff-cover coverage.xml --fail-under=100

because the first command, i.e. python -m nose2 -v {posargs} will run for every test environment, which is definitely not what I want. I need a way to run commands when they don't match a generated environment. Perhaps something like this would do the trick?

[testenv]
commands =
    : python -m nose2 -v {posargs}

It's possible of course that I'm missing something obvious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions