New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passenv statement should accept multi-line list #259

Closed
pytoxbot opened this Issue Sep 17, 2016 · 5 comments

Comments

Projects
None yet
1 participant
@pytoxbot

pytoxbot commented Sep 17, 2016

It would be useful to insert a large list of environment variables to 'passenv' instead of inserting a single long line.

@pytoxbot

This comment has been minimized.

pytoxbot commented Sep 17, 2016

Original comment by @hpk42

add changelog to fix issue259: passenv is now a line-list which allows to intersperse
comments. Thanks stefano-m.

→ <>

@pytoxbot

This comment has been minimized.

pytoxbot commented Sep 17, 2016

Original comment by @stefano-m

@hpk42, I have updated the PR following your advice. I hope I got everything right.

@pytoxbot

This comment has been minimized.

pytoxbot commented Sep 17, 2016

Original comment by @hpk42

Thanks for the PR and the discussion. I think allowing multi-line-list and splitting each non-comment line by hand would be workable. We need to check/test then that it works with factor-syntax (but i think it should). It should be backward compatible unless i am mistaken.

@stefano-m could you try this multi-line-list approach?

@pytoxbot

This comment has been minimized.

pytoxbot commented Sep 17, 2016

Original comment by @stefano-m

I have created pull request #166 that attempts to address this issue.

@pytoxbot

This comment has been minimized.

pytoxbot commented Sep 17, 2016

Original comment by @stefano-m

I second this request. I am afraid that this would break backwards compatibility though, and the passenv option is clearly specified as SPACE-SEPARATED-GLOBNAMES in the documentation anyway.

I have been (unsuccessfully) trying to modify the tox tests and code so that both styles work, i.e.

passenv =
             VAR1 VAR2

and

passenv =
            VAR1
            VAR2

but since the configuration specifies that the passenv option should be a space-separated-list I haven't found a way to keep the old behavior without "hacking" the passenv method in config.py.

Interestingly, if I change the passenv parameter to be of type line-list (and the test accordingly) the glob pattern still works and the test passes.

An advantage that I see in having a multi-line list is the ability to add comments. For example:

passenv =
             # for Xvfb
             DISPLAY
             # for node-gyp
             HOME

Such comments document why the variables need to be passed and help to maintain the tox.ini file. If, for example one does not need Xvfb any more, they'll know that they can safely remove DISPLAY from passenv.

If someone has any pointers, I'll try and make this work.

@pytoxbot pytoxbot closed this Sep 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment