We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85b4c08 commit 7920807Copy full SHA for 7920807
pytests/test_async_std_asyncio.rs
@@ -54,6 +54,24 @@ async fn test_async_sleep() -> PyResult<()> {
54
Ok(())
55
}
56
57
+#[pyo3_asyncio::async_std::test]
58
+async fn test_cancel() -> PyResult<()> {
59
+ let py_future = Python::with_gil(|py| {
60
+ pyo3_asyncio::async_std::into_coroutine(py, async {
61
+ async_std::task::sleep(Duration::from_secs(1)).await;
62
+ Ok(Python::with_gil(|py| py.None()))
63
+ })
64
+ })?;
65
+
66
+ Python::with_gil(|py| -> PyResult<_> {
67
+ py_future.as_ref(py).call_method0("cancel")?;
68
+ pyo3_asyncio::into_future(py_future.as_ref(py))
69
+ })?
70
+ .await?;
71
72
+ Ok(())
73
+}
74
75
#[pyo3_asyncio::async_std::test]
76
fn test_blocking_sleep() -> PyResult<()> {
77
common::test_blocking_sleep()
0 commit comments