Skip to content

Commit

Permalink
Remove always_run test macro parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Serock3 committed Aug 8, 2024
1 parent 320788d commit eb13624
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
3 changes: 0 additions & 3 deletions test/test-manager/src/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ pub async fn run(

if !test_filters.is_empty() {
tests.retain(|test| {
if test.always_run {
return true;
}
for command in test_filters {
let command = command.to_lowercase();
if test.command.to_lowercase().contains(&command) {
Expand Down
1 change: 0 additions & 1 deletion test/test-manager/src/tests/test_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub struct TestMetadata {
pub mullvad_client_version: MullvadClientVersion,
pub func: TestWrapperFunction,
pub priority: Option<i32>,
pub always_run: bool,
}

impl TestMetadata {
Expand Down
23 changes: 3 additions & 20 deletions test/test-manager/test_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ use test_rpc::meta::Os;
/// * `priority` - The order in which tests will be run where low numbers run before high numbers
/// and tests with the same number run in undefined order. `priority` defaults to 0.
///
/// * `always_run` - If the test should always run regardless of what test filters are provided by
/// the user. `always_run` defaults to false.
///
/// * `target_os` - The test should only run on the specified OS. This can currently be set to
/// `linux`, `windows`, or `macos`.
///
Expand All @@ -48,10 +45,10 @@ use test_rpc::meta::Os;
///
/// ## Create a test with custom parameters
///
/// This test will run early in the test loop and will always run.
/// This test will run early in the test loop.
///
/// ```ignore
/// #[test_function(priority = -1337, always_run = true)]
/// #[test_function(priority = -1337)]
/// pub async fn test_function(
/// rpc: ServiceClient,
/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient,
Expand Down Expand Up @@ -105,7 +102,6 @@ fn parse_marked_test_function(

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

for attribute in attributes {
Expand All @@ -120,11 +116,6 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
Lit::Int(lit_int) => priority = Some(lit_int.base10_parse().unwrap()),
_ => bail!(nv, "'priority' should have an integer value"),
}
} else if nv.path.is_ident("always_run") {
match lit {
Lit::Bool(lit_bool) => always_run = lit_bool.value(),
_ => bail!(nv, "'always_run' should have a bool value"),
}
} else if nv.path.is_ident("target_os") {
let Lit::Str(lit_str) = lit else {
bail!(nv, "'target_os' should have a string value");
Expand All @@ -145,11 +136,7 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
}
}

Ok(MacroParameters {
priority,
always_run,
targets,
})
Ok(MacroParameters { priority, targets })
}

fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
Expand All @@ -165,8 +152,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
})
.collect();

let always_run = test_function.macro_parameters.always_run;

let func_name = test_function.name;
let function_mullvad_version = test_function.function_parameters.mullvad_client.version();
let wrapper_closure = match test_function.function_parameters.mullvad_client {
Expand Down Expand Up @@ -207,7 +192,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
mullvad_client_version: #function_mullvad_version,
func: #wrapper_closure,
priority: #test_function_priority,
always_run: #always_run,
});
}
}
Expand All @@ -220,7 +204,6 @@ struct TestFunction {

struct MacroParameters {
priority: Option<i32>,
always_run: bool,
targets: Vec<Os>,
}

Expand Down

0 comments on commit eb13624

Please sign in to comment.