-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add ability to ignore tests at runtime. #68007
Comments
I would personally rather leave this to custom test frameworks; I think libtest should try to be minimal. It would also be good to spec this out a bit more. I imagine maybe a proc macro would be enough (i.e., inserting the env) and allowing |
This is a pain point which is encountered in uutils/coreutils#1041 (comment) |
This crate helps you ignore test case when the environment variable is absent. #[cfg(test)]
mod tests {
#[test_with::env(PWD)]
fn test_works() {
assert!(true);
}
#[test_with::env(NOTHING)]
fn test_ignored() {
panic!("should be ignored")
}
} |
See this pre-RFC thread on IRLO. |
ref rust-lang/cargo#10250, close #12804, ref rust-lang/rust#68007, ref rust-lang/rust#96132 Signed-off-by: tabokie <[email protected]>
For medium–large scale projects, or projects that have a lot of integrations with third party services. It would nice to be able to ignore tests based on the environment the tests are being run in. One example would be to run tests if an environment variable is present.
You can workaround this with something like the following, however the output of the test is
ok
and notignored
, misleading the user that the test was successful.The text was updated successfully, but these errors were encountered: