Skip to content

Environment variables required across unrelated environments #515

Description

@AndreLouisCaron

Hi there,

I have an issue where if one environment uses an {env:X} subsitution (without default), then that environment variable is required in all environments regardless of whether they are necessary or not.

Given this example tox.ini file:

[tox]
skipsdist = true

[testenv:standard-greeting]
commands =
  python -c 'print("Hello, world!")'

[testenv:custom-greeting]
passenv =
  NAME
commands =
  python -c 'print("Hello, {env:NAME}!"'

Then custom-greeting environment cannot be used unless NAME is present in the calling environment, even if that environment doesn't use the {env:NAME}.

$ tox -e standard-greeting
tox.ConfigError: ConfigError: substitution env:'NAME': unknown environment variable 'NAME'  or recursive definition.

I got this with tox 2.7.0 with both Python 3.5 and 2.7 on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions