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

The coverage-helper::test doesn't work with tokio::test #2

Open
Phoenix500526 opened this issue May 31, 2023 · 2 comments
Open

The coverage-helper::test doesn't work with tokio::test #2

Phoenix500526 opened this issue May 31, 2023 · 2 comments

Comments

@Phoenix500526
Copy link

Hi, @taiki-e.

Currently, the implementation of coverage_helper replaces std::test with coverage_helper::test. However, this approach doesn't work for tokio::test. Given that tokio::test is widely used, shall we support tokio::test in this crate?

IMO, we can provide a tokio module in coverage_helper, like:

mod test{
    use coverage_helper::{tokio, test};
    #[test]
    fn test_foo() {...}

    #[tokio::test]
    async fn test_bar() {...}
}

What do you think? If this approach is feasible, I can do some contributions.

@taiki-e
Copy link
Owner

taiki-e commented Jun 1, 2023

As said in taiki-e/cargo-llvm-cov#273, tokio::test refers ::core::prelude::v1::test, so it's not working with coverage_helper.

The most desirable fix is to change libtest so that the test attribute gets no_coverage, and the second most desirable is to make the change on the tokio side.

@taiki-e
Copy link
Owner

taiki-e commented Jun 1, 2024

This problem may have been resolved by tokio-macros 2.3.0, which includes tokio-rs/tokio#6497.

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

No branches or pull requests

2 participants