Skip to content

Generative section names don't work with empty factor #1636

@The-Compiler

Description

@The-Compiler

If I have a tox.ini like this:

[tox]
skipsdist = true

[testenv:foo]
commands =
    {envpython} -c "print('Hello World')"

[testenv:foo-factor]
commands =
    {envpython} -c "print('Factor given')"
    {envpython} -c "print('Hello World')"

Now I'd like to simplify this to use generative section names. I'd expect to either testenv:foo{,-factor} or testenv:foo-{,factor} to work. It looks like neither does.

This:

[tox]
skipsdist = true

[testenv:foo,{-factor}]
commands =
    factor: {envpython} -c "print('Factor given')"
    {envpython} -c "print('Hello World')"

results in:

$ tox -e foo-factor
ERROR: unknown environment 'foo-factor'

(or an empty run without any commands if foo-factor is added to envlist), while this:

[tox]
skipsdist = true

[testenv:foo-{,factor}]
commands =
    factor: {envpython} -c "print('Factor given')"
    {envpython} -c "print('Hello World')"

results in:

$ tox -e foo       
ERROR: unknown environment 'foo'

(as it defines an environment called foo-, not foo).

Am I missing something, or is the currently no way to do this kind of thing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:normalaffects many people or has quite an impactpr-merged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions