Skip to content
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 #[ignore] attribute to ignore test arguments #267

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

marcobacis
Copy link
Contributor

@marcobacis marcobacis commented Jul 21, 2024

Added the #[ignore] attribute to allow to ignore test arguments and let other crates (e.g. sqlx test runner or other proc macros) take care of them.

Fixes #228 and #91

Developed during Open Source Saturday

Comment on lines 52 to 61
#[rstest]
#[case::no_more_than_one("fn f(#[ignore] #[ignore] a: u32) {}", "more than once")]
fn raise_error(#[case] item_fn: &str, #[case] message: &str) {
let mut item_fn: ItemFn = item_fn.ast();

let err = extract_ignores(&mut item_fn).unwrap_err();

assert_in!(format!("{:?}", err), message);
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use rstest here is a little bit overkill ... but is fine 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied it from the by_ref implementation...converted to a simple test 👍

Comment on lines 1184 to +1187
///
/// ## Ignoring Arguments
///
/// Sometimes, you may want to inject and use fixtures not managed by rstest
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: please can you add a little note in Inject Test Attribute with a link to this section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 👍

Copy link
Owner

@la10736 la10736 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a greate job. I just ask you to add a little note in the test inject attribute section to recall this feature.... I guess that allmost of the peaple will find it usefull.

If you don't have time nevermid about this... Let me know and I'll do it by myself.

@marcobacis marcobacis requested a review from la10736 July 21, 2024 18:49
Copy link
Owner

@la10736 la10736 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx again!!!!

Great job.

LGTM

@la10736 la10736 merged commit fcf732d into la10736:master Jul 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add capability to ignore arguments
2 participants