Skip to content

Async fixture + Timeout doesn't work #154

@aviramha

Description

@aviramha
Contributor

It seems that async fixture + timeout doesn't work. I didn't dig in, but I assume the args are double-used, hence being moved.

    #[rstest]
    #[timeout(std::time::Duration::from_secs(100))]
    #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
    async fn test_sanity_flow(#[future] service: EchoService) {
        let _ = service.await;
        assert_eq!(1, 1);
    }

error:

196 |     #[rstest]
    |     --------- captured by this `Fn` closure
...
199 |     async fn test_sanity_flow(#[future] service: EchoService) {
    |                                         ^^^^^^^
    |                                         |
    |                                         captured outer variable
    |                   

Activity

la10736

la10736 commented on Jun 27, 2022

@la10736
Owner

Thx... I'm investigating... but maybe I need some time to fix it :(

aviramha

aviramha commented on Jun 27, 2022

@aviramha
ContributorAuthor

No problem, I appreciate you for maintaining this crate and being responsive. I'd suggest to send a PR but me + proc macros are terrible enemies 🙉

la10736

la10736 commented on Jun 27, 2022

@la10736
Owner

Ok the problem is bigger.... async timeout dosn't work with fixture.

la10736

la10736 commented on Jun 27, 2022

@la10736
Owner

I found the fix.... It's simple but I don't know when I can publish it .... I hope to find some time in the next days

la10736

la10736 commented on Jun 27, 2022

@la10736
Owner

Just as note it was that timeout annotated test cannot use dependency (case values, values or fixtures) that doesn't implement copy trait.

la10736

la10736 commented on Jun 27, 2022

@la10736
Owner

Released.... sorry for this crappy bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @la10736@aviramha

        Issue actions

          Async fixture + Timeout doesn't work · Issue #154 · la10736/rstest