Skip to content

test(llm-cli): fix Windows CI codex path assertions#1009

Merged
muddlebee merged 1 commit intoTracer-Cloud:mainfrom
muddlebee:fix/windows-codex-tests-posix-assertions
Apr 27, 2026
Merged

test(llm-cli): fix Windows CI codex path assertions#1009
muddlebee merged 1 commit intoTracer-Cloud:mainfrom
muddlebee:fix/windows-codex-tests-posix-assertions

Conversation

@muddlebee
Copy link
Copy Markdown
Collaborator

@muddlebee muddlebee commented Apr 27, 2026

Errors in windows due to #781

Describe the changes you have made in this PR -

Windows CI runs test (windows-latest) with sys.platform patched to linux/darwin in a few Codex fallback-path tests, but pathlib.Path still uses Windows separators on the runner. Assertions expected POSIX strings (/opt/...), so pytest failed on the Windows matrix (the workflow stays green only because that job uses continue-on-error).

This PR normalizes paths with Path(...).as_posix() in those tests so they stay valid on Windows hosts while still checking the intended locations.

Demo/Screenshot for feature changes and bug fixes -

N/A (test-only change). Local verification: uv run pytest tests/integrations/llm_cli/test_codex_adapter.py — 16 passed.


Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

Explain your implementation approach:

The production resolver already returns host-native path strings; the bug was test expectations that mixed “simulated OS” (sys.platform patch) with real Path flavor (still Windows on CI). Normalizing with as_posix() in assertions matches the existing pattern in test_fallback_paths_include_windows_defaults and avoids changing runtime behavior.


Checklist before requesting a review

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

Note: Please check Allow edits from maintainers if you would like us to assist in the PR.

- Add _posix_path_set for simulated linux/darwin fallback path checks
- Assert npm_prefix unix dirs via Path.as_posix() tuples
- Aligns with existing Windows test normalization pattern

Made-with: Cursor
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This test-only PR fixes Windows CI failures in four path assertions by normalising _fallback_codex_paths results with a new _posix_path_set helper (and inline .as_posix() calls), so that POSIX-style strings produced by mocking sys.platform compare correctly even when pathlib.Path still uses Windows separators on the runner.

Confidence Score: 5/5

Safe to merge — changes are test-only and correctly address the root cause.

All remaining findings are P2 or lower; the normalization approach is sound and consistent with the logic in binary_resolver.py. No production code is touched.

No files require special attention.

Important Files Changed

Filename Overview
tests/integrations/llm_cli/test_codex_adapter.py Adds _posix_path_set helper and normalizes four path assertions with Path.as_posix() so they pass on Windows CI when sys.platform is patched to POSIX values but pathlib.Path still uses Windows separators.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[pytest on Windows CI] --> B[patch sys.platform → linux/darwin]
    B --> C[_fallback_codex_paths]
    C --> D[default_cli_fallback_paths in binary_resolver]
    D --> E["str(Path(candidate).expanduser())\n→ Windows backslash paths"]
    E --> F[paths list contains backslash strings]
    F --> G{Before fix}
    F --> H{After fix}
    G --> I["assert '/opt/homebrew/bin/codex' in paths\n❌ FAILS on Windows CI"]
    H --> J["_posix_path_set: Path(p).as_posix()\n→ forward-slash set"]
    J --> K["assert '/opt/homebrew/bin/codex' in normalized\n✅ PASSES"]
Loading

Reviews (1): Last reviewed commit: "test(llm-cli): normalize path assertions..." | Re-trigger Greptile

@muddlebee muddlebee merged commit e913d51 into Tracer-Cloud:main Apr 27, 2026
7 checks passed
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