Skip to content

Commit

Permalink
Remove cleanup test macro parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Serock3 committed Aug 8, 2024
1 parent 7bfef3c commit 278fd96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
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 @@ -10,7 +10,6 @@ pub struct TestMetadata {
pub priority: Option<i32>,
pub always_run: bool,
pub must_succeed: bool,
pub cleanup: bool,
}

impl TestMetadata {
Expand Down
18 changes: 2 additions & 16 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.
///
/// * `cleanup` - If the cleanup function will run after the test is finished and among other things
/// reset the settings to the default value for the daemon. `cleanup` defaults to true.
///
/// * `must_succeed` - If the testing suite stops running if this test fails. `must_succeed`
/// defaults to false.
///
Expand Down Expand Up @@ -54,11 +51,10 @@ use test_rpc::meta::Os;
///
/// ## Create a test with custom parameters
///
/// This test will run early in the test loop, won't perform any cleanup, must
/// succeed and will always run.
/// This test will run early in the test loop and must succeed and will always run.
///
/// ```ignore
/// #[test_function(priority = -1337, cleanup = false, must_succeed = true, always_run = true)]
/// #[test_function(priority = -1337, must_succeed = true, always_run = true)]
/// pub async fn test_function(
/// rpc: ServiceClient,
/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient,
Expand Down Expand Up @@ -112,7 +108,6 @@ fn parse_marked_test_function(

fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroParameters> {
let mut priority = None;
let mut cleanup = true;
let mut always_run = false;
let mut must_succeed = false;
let mut targets = vec![];
Expand All @@ -139,11 +134,6 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
Lit::Bool(lit_bool) => must_succeed = lit_bool.value(),
_ => bail!(nv, "'must_succeed' should have a bool value"),
}
} else if nv.path.is_ident("cleanup") {
match lit {
Lit::Bool(lit_bool) => cleanup = lit_bool.value(),
_ => bail!(nv, "'cleanup' 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 @@ -166,7 +156,6 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar

Ok(MacroParameters {
priority,
cleanup,
always_run,
must_succeed,
targets,
Expand All @@ -186,7 +175,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
})
.collect();

let should_cleanup = test_function.macro_parameters.cleanup;
let always_run = test_function.macro_parameters.always_run;
let must_succeed = test_function.macro_parameters.must_succeed;

Expand Down Expand Up @@ -232,7 +220,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
priority: #test_function_priority,
always_run: #always_run,
must_succeed: #must_succeed,
cleanup: #should_cleanup,
});
}
}
Expand All @@ -245,7 +232,6 @@ struct TestFunction {

struct MacroParameters {
priority: Option<i32>,
cleanup: bool,
always_run: bool,
must_succeed: bool,
targets: Vec<Os>,
Expand Down

0 comments on commit 278fd96

Please sign in to comment.