-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Abstract
We want to skip tests if certain environment variables are NOT set (e.g. SOCKS_PROXY
) so that developers do not need to provide a full-blown integration test infrastructure if they only work on a subset of the features.
ACs
- tests are skipped when environment variables are NOT set
- tests are skipped at runtime, NOT at compile time
- skipped tests are marked as "ignored"
- tests skipping requires little code (ideally a single line in form of a decorator, a function call, a macro call)
Current Situation
We currently use macros like this:
Lines 75 to 93 in 6510b23
/// Get the Socks Proxy environment variable. | |
/// | |
/// If `SOCKS_PROXY` is not set, fail the tests and provide | |
/// guidance for setting `SOCKS_PROXY`. | |
#[macro_export] | |
macro_rules! maybe_skip_SOCKS_PROXY { | |
() => {{ | |
use std::env; | |
dotenv::dotenv().ok(); | |
match (env::var("SOCKS_PROXY").ok()) { | |
Some(proxy) => proxy, | |
_ => { | |
eprintln!("skipping integration tests with Proxy - set SOCKS_PROXY to run"); | |
return; | |
} | |
} | |
}}; | |
} |
This fulfills all ACs except for skipped tests are marked as "ignored"
.
References
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
crepererum commentedon May 24, 2022
@mario-s volunteered to work on this 🎉