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-codens_aware
parent
0f29f5717a
commit
2bf155131d
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue