How to call async functions in tests

I'm writing a test that needs to call async function before asserting on result.
Test looks something like this:

#[cfg(test)]
mod test {
  #[tokio::test]
  async fn test_foo() {
    let foo = make_foo().await.expect("Error making foo");
    assert_eq(foo, 1);
  }
}

I keep getting this error:

there is no timer running, must be called from the context of Tokio runtime

What am I missing here?

You've probably used Tokio 0.3 with a library that expects Tokio 0.2.

1 Like

You are absolutely right. :see_no_evil:
Thank you!