Open yds12 opened 2 years ago
Hi, unfortunately I haven't been able to reproduce. My setup (where I did not use asserhttp):
reqwest = { version = "0.11", features = ["json", "blocking"], default-features = false }
tokio = { version = "1.15", features = ["macros", "rt"] }
#[tokio::test]
async fn test() {
reqwest::get("https://github.com").await.unwrap();
}
// Fails with:
// called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "https",
// cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")),
// port: None, path: "/", query: None, fragment: None }, source: hyper::Error(Connect, "invalid URL,
// scheme is not http") }
Anyway, I don't know the probable cause but I think here that I should timeout instead of letting this thread block forever
Hello, this is the minimal example I could make:
and this in my
Cargo.toml
:When running
cargo test
, the test just hangs indefinitely. If the same code is ran inmain
(withtokio::main
) it works fine.The issue is with this line, the call to
futures_lite::future::block_on
. The issue seems to be thattokio::test
uses a single-threaded executor, whereastokio::main
is usually multi-threaded.