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

Feature Request: Add Support for rstest Dependency Integration #88

Closed
SwannHERRERA opened this issue Jun 6, 2024 · 2 comments · Fixed by #89
Closed

Feature Request: Add Support for rstest Dependency Integration #88

SwannHERRERA opened this issue Jun 6, 2024 · 2 comments · Fixed by #89
Assignees

Comments

@SwannHERRERA
Copy link

First of all, thank you for the great work on the test-with crate.
I would like to request a new feature that integrates the rstest crate with test-with. Specifically, I am looking for a way to conditionally run parameterized tests defined using rstest within the test-with macro.

something like that :

 #[rstest]
    #[case(4, 5, 9)]
    #[case(5, 5, 10)]
    #[test_with::env("RUN_CONDITIONAL_TESTS")]
    fn test_add_conditional(#[case] a: i32, #[case] b: i32, #[case] expected: i32) {
        assert_eq!(add(a, b), expected);
    }

I don't know if it's possible to do something like that with the actual code. I think it will require some custom code.

That will be great if we can enable a feature flag that allow us to override the tests rendered by rstest.

@yanganto yanganto self-assigned this Jun 7, 2024
@yanganto
Copy link
Owner

yanganto commented Jun 7, 2024

Thanks for the idea. The current #[test-with] is workable for your case.

It is good to set #[test-with] as the inner macro for a test function, but the #[rstest] will change the normal function to a test function. Therefore, in your case, the #[test-with] is the outer one.

@yanganto
Copy link
Owner

yanganto commented Jun 7, 2024

By the way, if you run into any issues, it will always be welcome to reopen this. 😄

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 a pull request may close this issue.

2 participants