chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

40
vendor/tower/tests/util/oneshot.rs vendored Normal file
View File

@@ -0,0 +1,40 @@
use std::task::{Context, Poll};
use std::{future::Future, pin::Pin};
use tower::util::ServiceExt;
use tower_service::Service;
#[tokio::test(flavor = "current_thread")]
async fn service_driven_to_readiness() {
// This test ensures that `oneshot` will repeatedly call `poll_ready` until
// the service is ready.
let _t = super::support::trace_init();
struct PollMeTwice {
ready: bool,
}
impl Service<()> for PollMeTwice {
type Error = ();
type Response = ();
type Future = Pin<
Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + Sync + 'static>,
>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), ()>> {
if self.ready {
Poll::Ready(Ok(()))
} else {
self.ready = true;
cx.waker().wake_by_ref();
Poll::Pending
}
}
fn call(&mut self, _: ()) -> Self::Future {
assert!(self.ready, "service not driven to readiness!");
Box::pin(async { Ok(()) })
}
}
let svc = PollMeTwice { ready: false };
svc.oneshot(()).await.unwrap();
}