Temporary Environment Variables
temp_env_vars allows to rest all changes to environment variables changed
within the execution of a certain function.
[!WARNING] This crate is under active development and will probably have braking changes
Installation
Usage
temp_env_vars can be used in two different forms:
- as macro
#[temp_env_vars] - with
TempEnvScope::new()
Use as macro
#[temp_env_vars] is the preferred way to use the temp_env_vars crate.
Every change to envionrment variables within the execution of the annotated function
will be reset after the function has ended.
If more tests are used with this macro, those tests will be executed sequentially to avoid an enviornment variable mixup.
Use with TempEnvScope
If resetting the environment variables after the function execution is not sufficient,
but the reset must happen somewhere within the function, the TempEnvScope can be
used to have better control.
Whenever the created TempEnvScope goes out of scope, all env vars are reset.
// Use external "serial" crate as parallel tests mix up envs
// Use external "serial" crate as parallel tests mix up envs
Contribution
Contribution are always welcome in any form.
You acknowledge and agree that the owner reserve the right to change the license of the Work, including but not limited to all Contributions previously submitted by You, at any time without the need for approval from You or any other contributor.
License
This project is licensed under the https://github.com/guenhter/temp_env_vars/blob/main/LICENSE[MIT license].