From 2bf155131db360b78cddbe9a373eed1d16166d9d Mon Sep 17 00:00:00 2001 From: goodboy Date: Thu, 12 Mar 2026 17:16:16 -0400 Subject: [PATCH] Make `spawn()` `expect_timeout` configurable Add `expect_timeout: float` param to `_spawn()` so individual tests can tune `pexpect` timeouts instead of relying on the hard-coded 3/10 split. Deats, - default to 4s, bump by +6 on non-linux CI. - use walrus `:=` to capture resolved timeout and assert `spawned.timeout == timeout` for sanity. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tests/devx/conftest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/devx/conftest.py b/tests/devx/conftest.py index fbb4ff6b..eb56d74c 100644 --- a/tests/devx/conftest.py +++ b/tests/devx/conftest.py @@ -89,6 +89,7 @@ def spawn( def _spawn( cmd: str, + expect_timeout: float = 4, **mkcmd_kwargs, ) -> pty_spawn.spawn: nonlocal spawned @@ -98,14 +99,17 @@ def spawn( cmd, **mkcmd_kwargs, ), - expect_timeout=( - 10 if _non_linux and _ci_env - else 3 - ), + expect_timeout=(timeout:=( + expect_timeout + 6 + if _non_linux and _ci_env + else expect_timeout + )), # preexec_fn=unset_colors, # ^TODO? get `pytest` core to expose underlying # `pexpect.spawn()` stuff? ) + # sanity + assert spawned.timeout == timeout return spawned # such that test-dep can pass input script name.