Bump `_PROC_SPAWN_WAIT` and use `test_log` in `daemon`

For more reliability with the oob registrar using tests
via the `daemon` fixture,
- increase spawn-wait to `2` in CI, `1` OW; drop
  the old py<3.7 branch.
- move `_ci_env` to module-level (above `_non_linux`)
  so `_PROC_SPAWN_WAIT` can reference it at parse time.
- add `test_log` fixture param to `daemon()`, use it
  for the error-on-exit log line instead of bare `log`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
ns_aware
Gud Boi 2026-03-12 17:32:05 -04:00
parent 2bf155131d
commit 8a2f74da2c
1 changed files with 5 additions and 7 deletions

View File

@ -23,6 +23,7 @@ pytest_plugins: list[str] = [
'tractor._testing.pytest',
]
_ci_env: bool = os.environ.get('CI', False)
_non_linux: bool = platform.system() != 'Linux'
# Sending signal.SIGINT on subprocess fails on windows. Use CTRL_* alternatives
@ -36,9 +37,8 @@ else:
_INT_SIGNAL = signal.SIGINT
_INT_RETURN_CODE = 1 if sys.version_info < (3, 8) else -signal.SIGINT.value
_PROC_SPAWN_WAIT = (
0.6
if sys.version_info < (3, 7)
else 0.4
2 if _ci_env
else 1
)
@ -115,9 +115,6 @@ def test_log(
yield _log
_ci_env: bool = os.environ.get('CI', False)
@pytest.fixture(scope='session')
def ci_env() -> bool:
'''
@ -152,6 +149,7 @@ def daemon(
reg_addr: tuple[str, int],
tpt_proto: str,
ci_env: bool,
test_log: tractor.log.StackLevelAdapter,
) -> subprocess.Popen:
'''
@ -240,7 +238,7 @@ def daemon(
if rc < 0:
raise RuntimeError(msg)
log.error(msg)
test_log.error(msg)
# @pytest.fixture(autouse=True)