-
Couldn't load subscription status.
- Fork 2.7k
Description
Describe the problem you are trying to solve
I would like to unset environment variables when tests are run.
I need this because I have tests for a CLI program (it uses structopt) and if the environment I'm running in has certain environment variables set it can interfere with the tests.
Describe the solution you'd like
I first tried to remove the environment variables in a build script using std::env::remove_var("VAR") but that didn't work.
Then tried to do this in a build script using cargo:rustc-env=VAR= however this still sets it to an empty string. So a similar option like cargo:rustc-remove-env=VAR would be nice. Of course a way to run some code before tests are run could also solve this.
So now I have to remove the environment variables in every test :/