test(cli): cherry-pick #1101 to verify ci:windows label CI#1102
test(cli): cherry-pick #1101 to verify ci:windows label CI#1102muddlebee wants to merge 1 commit intoTracer-Cloud:mainfrom
Conversation
…racer-Cloud#1099) The post-merge ``test (windows-latest)`` job on commit 67dc64d (PR Tracer-Cloud#1090 landing) is failing with two distinct symptoms in the install.sh test suites added by PR Tracer-Cloud#1064: 1. ``tests/cli/test_install_sh_path.py`` — 12 tests fail because the subprocess call ``subprocess.run(["bash", "-c", script])`` resolves ``bash`` to ``wsl.exe`` on the GitHub Actions ``windows-latest`` runner, and that runner has no installed WSL distribution. Every ``_run`` call exits 1 with a literal "Windows Subsystem for Linux has no installed distributions" message, so none of the asserted rc files (``.zshrc``/``.bashrc``/``config.fish``) ever get written. 2. ``tests/cli/test_install_sh_resolution.py`` — module fails to import on Windows: the existing ``@pytest.mark.skipif(os.geteuid() == 0, reason=...)`` decorator evaluates ``os.geteuid()`` at decorator-application time, but ``os.geteuid`` does not exist on Windows. ``AttributeError`` fires *before* pytest can read any markers, blocking collection of every test in the module. Both files exclusively test ``install.sh``, which is a POSIX shell script (zsh/bash/fish RC files) with no Windows analogue, so the correct fix for the Windows runner is to skip them. Changes: - ``test_install_sh_path.py``: module-level ``pytestmark = pytest.mark.skipif(sys.platform == "win32", ...)`` with a comment that names the failure mode. - ``test_install_sh_resolution.py``: same module-level skipif, *and* defensively replace ``os.geteuid() == 0`` with ``_RUNNING_AS_ROOT = hasattr(os, "geteuid") and os.geteuid() == 0`` evaluated once at module load. ``hasattr`` short-circuits the ``and`` on Windows so ``os.geteuid()`` is never called there — the module imports cleanly even before pytest reads ``pytestmark``. No source-checkout behaviour change: skipif is a no-op on macOS/Linux, and the existing root-only test still skips correctly on those platforms (verified by running ``pytest tests/cli/test_install_sh_path.py tests/cli/test_install_sh_resolution.py`` locally — 15 / 15 pass). Full unit suite: 4164 pass / 2 skipped / 1 xfailed. Closes Tracer-Cloud#1099.
Greptile SummaryThis PR cherry-picks Windows CI compatibility fixes for two Confidence Score: 5/5Safe to merge — targeted, well-reasoned Windows CI compatibility fixes with no logic changes to existing tests. Both changes are minimal and correct: the No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pytest collects module] --> B{sys.platform == win32?}
B -- Yes --> C[pytestmark: skip all tests in module]
B -- No --> D[Module-level code executes normally]
D --> E[test_install_sh_path.py tests]
D --> F[test_install_sh_resolution.py tests]
E --> G[bash subprocess runs install.sh functions]
F --> H["_RUNNING_AS_ROOT = hasattr(os, geteuid) and os.geteuid() == 0"]
H --> I{_RUNNING_AS_ROOT?}
I -- Yes --> J[skipif: skip sudo test]
I -- No --> K[run test_uses_sudo_for_non_writable_system_path_dir]
F --> L[run other resolution tests normally]
Reviews (1): Last reviewed commit: "test(cli): skip install.sh tests on Wind..." | Re-trigger Greptile |
Purpose
Smoke-test the merged CI Labels workflow (
ci:windows) on a branch based on latestmain.This is a cherry-pick of #1101 (
11ca577) onto currentmainso the PR head branch includes.github/workflows/ci-labels.ymlfrom upstream.How to verify
ci:windowson this PR.Note
Contributor fork PRs do not inherit new workflow files until the branch syncs with
main; this duplicates the logical change here for validation only. Close/replace once #1101 is updated frommainif redundant.