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(
|
def _spawn(
|
||||||
cmd: str,
|
cmd: str,
|
||||||
|
expect_timeout: float = 4,
|
||||||
**mkcmd_kwargs,
|
**mkcmd_kwargs,
|
||||||
) -> pty_spawn.spawn:
|
) -> pty_spawn.spawn:
|
||||||
nonlocal spawned
|
nonlocal spawned
|
||||||
|
|
@ -98,14 +99,17 @@ def spawn(
|
||||||
cmd,
|
cmd,
|
||||||
**mkcmd_kwargs,
|
**mkcmd_kwargs,
|
||||||
),
|
),
|
||||||
expect_timeout=(
|
expect_timeout=(timeout:=(
|
||||||
10 if _non_linux and _ci_env
|
expect_timeout + 6
|
||||||
else 3
|
if _non_linux and _ci_env
|
||||||
),
|
else expect_timeout
|
||||||
|
)),
|
||||||
# preexec_fn=unset_colors,
|
# preexec_fn=unset_colors,
|
||||||
# ^TODO? get `pytest` core to expose underlying
|
# ^TODO? get `pytest` core to expose underlying
|
||||||
# `pexpect.spawn()` stuff?
|
# `pexpect.spawn()` stuff?
|
||||||
)
|
)
|
||||||
|
# sanity
|
||||||
|
assert spawned.timeout == timeout
|
||||||
return spawned
|
return spawned
|
||||||
|
|
||||||
# such that test-dep can pass input script name.
|
# such that test-dep can pass input script name.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue