Open nfarahmand opened 4 months ago
Hi! To clarify is this primarily with tests you have this problem or with all parts of your setup?
Yeah it mostly becomes a problem when I run tests, both from within the VS Code UI and through the integrated terminal. In both instances, they have the environment variables loaded but those variables mess up the tests. The .env
file is read when my app starts up so I don't see a need to have it auto-loaded into the env (at least not for any of my use cases).
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
yes +1 to this, I was recently bitten by this. To me .env
is for vars that my app runs on, not that I want loaded into my shell — those can be very different! I'm sure many VSCode users find it useful, but personally I would want it off by default.
The Python extension looks for and loads the
.env
file within a workspace, which loads those variables into the environment for tests and the integrated terminal. This feature should be made optional with a setting to turn it off. The.env
file in a workspace often is not the settings someone would like to use when running unit tests, so tests will fail with those settings. Without a way to turn it off, I have to either comment out the.env
file before running unit tests, or go to another terminal outside of VS Code to run my tests.Please make the auto-loading of
.env
files in a workspace optional with a setting to turn it off.