Skip to content

Keep Unix-only stdlib out of CLI and pytest import paths - #533

Open
brainRottedCoder wants to merge 1 commit into
experientiallabs:mainfrom
brainRottedCoder:fix/532-windows-posix-imports
Open

Keep Unix-only stdlib out of CLI and pytest import paths#533
brainRottedCoder wants to merge 1 commit into
experientiallabs:mainfrom
brainRottedCoder:fix/532-windows-posix-imports

Conversation

@brainRottedCoder

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run ty check (Ubuntu CI; Windows ty still fails on POSIX stubs)
  • uv run pytest -q wmo/tests/posix_stdlib_import_test.py wmo/cli/shared/picker_test.py wmo/cli/judge/trace_viewer_test.py
  • uv run python -c "import wmo.cli.app; import wmo.conftest"
  • uv run pytest --collect-only -q wmo

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR defers Unix-only standard-library imports to POSIX helpers, adds non-POSIX skips, and introduces package-wide import regression checks. The installed-release evidence path remains capable of invoking the PTY helper on Windows.

  • Moves terminal-specific imports out of CLI and pytest module scope.
  • Adds POSIX gating for keyboard and pseudo-terminal tests.
  • Adds AST scanning and subprocess smoke coverage for import safety.

Confidence Score: 4/5

The PR is not yet safe to merge because the installed-release evidence test still reaches Unix-only PTY imports during a Windows pytest run.

The direct terminal-close-race test now skips correctly, but the undecorated installed-wheel evidence test executes a copied driver whose interactive flow calls _run_tty_child and imports unavailable POSIX modules.

Files Needing Attention: exp/tests/release_test.py

Important Files Changed

Filename Overview
exp/tests/release_test.py Defers PTY imports and guards the race test, but the installed-wheel evidence test still reaches the POSIX-only helper on Windows.
exp/tests/posix_stdlib_import_test.py Adds package-wide module-scope import enforcement, with a non-blocking gap for except* statement bodies.
exp/conftest.py Defers POSIX imports and skips the terminal-child fixture on non-POSIX hosts.
exp/cli/shared/picker.py Defers terminal imports and routes Windows consoles through the line-based picker.
exp/cli/judge/trace_viewer.py Moves terminal-only imports into the raw-key helper.

Reviews (3): Last reviewed commit: "Keep Unix-only stdlib out of CLI and pyt..." | Re-trigger Greptile

Comment thread exp/tests/release_test.py
Comment thread exp/tests/posix_stdlib_import_test.py
Import fcntl, pty, termios, and tty only inside POSIX helpers so Windows can collect tests and import exp.cli. Skip the direct TTY close-race caller off POSIX. Fixes experientiallabs#532.
@brainRottedCoder
brainRottedCoder force-pushed the fix/532-windows-posix-imports branch from ff6069b to 4e189bb Compare August 20, 2026 18:55
Comment thread exp/tests/release_test.py
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.

pytest cannot collect on Windows: wmo/conftest.py imports Unix-only fcntl

1 participant