Skip to content

Commit 372d6d7

Browse files
committed
Remove always_run test macro parameter
1 parent 6e5c2a4 commit 372d6d7

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

test/test-manager/src/run_tests.rs

-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ pub async fn run(
147147

148148
if !test_filters.is_empty() {
149149
tests.retain(|test| {
150-
if test.always_run {
151-
return true;
152-
}
153150
for command in test_filters {
154151
let command = command.to_lowercase();
155152
if test.command.to_lowercase().contains(&command) {

test/test-manager/src/tests/test_metadata.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub struct TestMetadata {
88
pub mullvad_client_version: MullvadClientVersion,
99
pub func: TestWrapperFunction,
1010
pub priority: Option<i32>,
11-
pub always_run: bool,
1211
}
1312

1413
impl TestMetadata {

test/test-manager/test_macro/src/lib.rs

+3-20
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ use test_rpc::meta::Os;
2323
/// * `priority` - The order in which tests will be run where low numbers run before high numbers
2424
/// and tests with the same number run in undefined order. `priority` defaults to 0.
2525
///
26-
/// * `always_run` - If the test should always run regardless of what test filters are provided by
27-
/// the user. `always_run` defaults to false.
28-
///
2926
/// * `target_os` - The test should only run on the specified OS. This can currently be set to
3027
/// `linux`, `windows`, or `macos`.
3128
///
@@ -48,10 +45,10 @@ use test_rpc::meta::Os;
4845
///
4946
/// ## Create a test with custom parameters
5047
///
51-
/// This test will run early in the test loop and will always run.
48+
/// This test will run early in the test loop.
5249
///
5350
/// ```ignore
54-
/// #[test_function(priority = -1337, always_run = true)]
51+
/// #[test_function(priority = -1337)]
5552
/// pub async fn test_function(
5653
/// rpc: ServiceClient,
5754
/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient,
@@ -105,7 +102,6 @@ fn parse_marked_test_function(
105102

106103
fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroParameters> {
107104
let mut priority = None;
108-
let mut always_run = false;
109105
let mut targets = vec![];
110106

111107
for attribute in attributes {
@@ -120,11 +116,6 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
120116
Lit::Int(lit_int) => priority = Some(lit_int.base10_parse().unwrap()),
121117
_ => bail!(nv, "'priority' should have an integer value"),
122118
}
123-
} else if nv.path.is_ident("always_run") {
124-
match lit {
125-
Lit::Bool(lit_bool) => always_run = lit_bool.value(),
126-
_ => bail!(nv, "'always_run' should have a bool value"),
127-
}
128119
} else if nv.path.is_ident("target_os") {
129120
let Lit::Str(lit_str) = lit else {
130121
bail!(nv, "'target_os' should have a string value");
@@ -145,11 +136,7 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
145136
}
146137
}
147138

148-
Ok(MacroParameters {
149-
priority,
150-
always_run,
151-
targets,
152-
})
139+
Ok(MacroParameters { priority, targets })
153140
}
154141

155142
fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
@@ -165,8 +152,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
165152
})
166153
.collect();
167154

168-
let always_run = test_function.macro_parameters.always_run;
169-
170155
let func_name = test_function.name;
171156
let function_mullvad_version = test_function.function_parameters.mullvad_client.version();
172157
let wrapper_closure = match test_function.function_parameters.mullvad_client {
@@ -207,7 +192,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
207192
mullvad_client_version: #function_mullvad_version,
208193
func: #wrapper_closure,
209194
priority: #test_function_priority,
210-
always_run: #always_run,
211195
});
212196
}
213197
}
@@ -220,7 +204,6 @@ struct TestFunction {
220204

221205
struct MacroParameters {
222206
priority: Option<i32>,
223-
always_run: bool,
224207
targets: Vec<Os>,
225208
}
226209

0 commit comments

Comments
 (0)