Skip to content

test(statusline): hold the contended lock in a subprocess, not os.fork - #261

Merged
aqua5230 merged 1 commit into
mainfrom
test/statusline-lock-no-fork
Oct 23, 2026
Merged

aqua5230 merged 1 commit into
mainfrom
test/statusline-lock-no-fork

Conversation

@aqua5230

Copy link
Copy Markdown
Owner

Summary

  • test_exclusive_lock_times_out_when_another_process_holds_it used os.fork() inside pytest's multi-threaded process, which emits DeprecationWarning: ... use of fork() may lead to deadlocks in the child.
  • The lock holder is now a fresh interpreter started with subprocess.Popen. It releases the flock when the test closes its stdin, replacing the fixed 0.3 s sleep.
  • Drops the # type: ignore[attr-defined] that os.fork needed for mypy on Windows.

Test plan

  • uv run pytest -q -rw: 3119 passed, 0 warnings (was 1)
  • tests/test_usage_statusline.py with -W error::DeprecationWarning, 3 runs
  • ruff check, ruff format --check, mypy ., scripts/check_file_size.py

🤖 Generated with Claude Code

pytest's process is already multi-threaded, so os.fork() raised a
DeprecationWarning about possible deadlocks in the child. A fresh
interpreter now holds the flock until the test closes its stdin, which
also replaces the 0.3 s sleep with an explicit release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T18:49:56.279242Z 7a2b14c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aqua5230
aqua5230 merged commit 577e2df into main Oct 23, 2026
7 checks passed
@aqua5230
aqua5230 deleted the test/statusline-lock-no-fork branch October 23, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant