Skip to content
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

Use environment variables in tox.ini #1098

Open
anselmbradford opened this issue Oct 16, 2015 · 6 comments
Open

Use environment variables in tox.ini #1098

anselmbradford opened this issue Oct 16, 2015 · 6 comments

Comments

@anselmbradford
Copy link
Member

anselmbradford commented Oct 16, 2015

For example, can https://github.com/cfpb/consumerfinance.gov/blob/main/tox.ini#L87 use https://github.com/cfpb/consumerfinance.gov/blob/main/.env_SAMPLE#L66 ? For that and the other settings that appear in the environment (ES_PORT and ES_HOST).

@anselmbradford
Copy link
Member Author

anselmbradford commented May 20, 2016

Hey bewds, just looking through old issues. Seems like this would be a quick one? @richaagarwal @willbarton @chosak

@kurtrwall
Copy link
Contributor

Sorry for neglecting this one. Yes, you can totally do that.

@anselmbradford
Copy link
Member Author

anselmbradford commented Aug 1, 2019

Updated example is https://github.com/cfpb/consumerfinance.gov/blob/main/tox.ini#L86 (WAGTAIL_SHARING_HOSTNAME=content.localhost), which is set in https://github.com/cfpb/consumerfinance.gov/blob/master/.env_SAMPLE#L27 (export WAGTAIL_SHARING_HOSTNAME=content.localhost).

@cfpb cfpb deleted a comment from anselmbradford May 26, 2021
@chosak
Copy link
Member

chosak commented May 23, 2023

@anselmbradford can this ancient issue be closed? The list of environment variables that tox passes in can be found here.

@anselmbradford
Copy link
Member Author

I'm not sure. My original inquiry was about why we duplicated the variable and value of, for example, WAGTAIL_SHARING_HOSTNAME=content.localhost in both tox.ini (here) and in .env_SAMPLE (here).

Is there a reason we'd create those envvars in .env and then recreate them in tox.ini without using the existing one? Or could it be deleted from .env_SAMPLE?

@chosak
Copy link
Member

chosak commented Feb 23, 2024

@anselmbradford we don't always have a .env file when running tox, for example when it runs as part of automated testing on GitHub Actions. So tox.ini needs to define all the environment variables that it needs to run its tests. Separately, .env (and its template .env_SAMPLE) are intended to help devs configure their local environment even in ways that might differ from what we test.

As it happens though, and somewhat surprisingly to me, none of our Python tests actually make use of the value of either WAGTAIL_SHARING_HOSTNAME or GOVDELIVERY_ACCOUNT_CODE. So these can be removed from tox.ini: #8165

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

No branches or pull requests

4 participants