From 9960edf24809a3ff4d1b53578c5581de13dccd24 Mon Sep 17 00:00:00 2001 From: Jeremy Howard Date: Mon, 31 Aug 2026 09:59:42 +1000 Subject: [PATCH] Make pyzmq peer tests self-contained and bounded --- .github/workflows/ci.yml | 2 +- README.md | 2 +- tests/server.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64473f5..d326d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v7 with: python-version: '3.12' - - run: pip install ipymini + - run: pip install ipymini pyzmq - run: cargo fmt --check - run: cargo clippy --all-targets -- -D warnings - run: cargo test diff --git a/README.md b/README.md index d5d6963..6999d20 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ let msg = iopub.recv().await?; cargo test ``` -The integration tests run against a real kernel. Install it first with `pip install ipymini`. Set `ZMTPMINI_TEST_PYTHON` to choose which Python runs it. +The integration tests run against a real kernel and pyzmq peers. Install them first with `pip install ipymini pyzmq`. Set `ZMTPMINI_TEST_PYTHON` to choose which Python runs them. ## Release diff --git a/tests/server.rs b/tests/server.rs index c08bfa8..29b44a1 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1,6 +1,7 @@ //! The accepting-side story against unmodified pyzmq DEALER, SUB, and REQ peers. use std::process::Command; +use std::time::Duration; use tokio::net::TcpListener; use zmtpmini::{Incoming, Peer}; @@ -40,6 +41,10 @@ async fn pyzmq_peer_story() { writer.send(message).await.unwrap(); }; - tokio::join!(router_story, publisher_story, reply_story); + if tokio::time::timeout(Duration::from_secs(30), async { tokio::join!(router_story, publisher_story, reply_story) }).await.is_err() { + let _ = child.kill(); + let _ = child.wait(); + panic!("pyzmq peer timed out"); + } assert!(child.wait().unwrap().success()); }