Skip to content

fix(test): patch sys.platform in cowork tests for Windows CI#989

Merged
sergio-sisternes-epam merged 1 commit intomainfrom
fix/cowork-windows-ci
Apr 27, 2026
Merged

fix(test): patch sys.platform in cowork tests for Windows CI#989
sergio-sisternes-epam merged 1 commit intomainfrom
fix/cowork-windows-ci

Conversation

@sergio-sisternes-epam
Copy link
Copy Markdown
Collaborator

Summary

Fixes the 6 test failures introduced by #926 on Windows CI (run).

Root cause

5 tests in test_copilot_cowork_paths.py -- macOS auto-detection tests did not mock sys.platform. On Windows CI the code enters the win32 branch first and returns None without ever reaching the ~/Library/CloudStorage glob logic. Two additional tests (zero_tenant, no_cloud_storage) passed for the wrong reason (the Windows short-circuit happened to return None, matching the expected result).

1 test in test_config_command.py -- os.path.expanduser("~/myskills") on Windows produces a path with mixed separators, while os.path.join(home, "myskills") uses native backslashes. The assertion failed because the strings differed.

Fix

  1. Every platform-specific test now patches apm_cli.integration.copilot_cowork_paths.sys.platform to the intended OS ("darwin" for macOS, "linux" for Linux).
  2. set_copilot_cowork_skills_dir now normalises the expanded path with os.path.normpath to avoid mixed separators on Windows.

Validation

5752 tests pass locally (macOS). The platform patches ensure the same code paths are exercised on all CI runners.

macOS auto-detection tests did not mock sys.platform, so on Windows CI
the code entered the win32 branch first and returned None without ever
reaching the CloudStorage glob logic. 5 tests failed; 2 more passed
for the wrong reason (win32 short-circuit returning None matched the
expected result).

Fix: every platform-specific test now patches
apm_cli.integration.copilot_cowork_paths.sys.platform to the intended
OS ("darwin" for macOS tests, "linux" for the Linux test).

Also normalise the path in set_copilot_cowork_skills_dir with
os.path.normpath to avoid mixed separators on Windows (forward slash
from tilde expansion vs backslash from os.path.join).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Windows CI test failures introduced by the cowork target work by making platform-specific unit tests explicitly control sys.platform, and by normalizing a config path to avoid mixed path separators on Windows.

Changes:

  • Patch apm_cli.integration.copilot_cowork_paths.sys.platform in macOS/Linux cowork path resolution tests so the intended code paths run consistently on all CI runners.
  • Normalize set_copilot_cowork_skills_dir() stored paths via os.path.normpath(os.path.expanduser(...)) to avoid mixed separators on Windows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/unit/integration/test_copilot_cowork_paths.py Ensures platform-dependent resolution tests force the intended OS branch (darwin/linux) rather than inheriting the CI runner’s platform.
src/apm_cli/config.py Normalizes expanded cowork skills dir paths to keep Windows path separators consistent and stabilize related assertions.

@sergio-sisternes-epam sergio-sisternes-epam added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 4a9cae1 Apr 27, 2026
37 checks passed
@sergio-sisternes-epam sergio-sisternes-epam deleted the fix/cowork-windows-ci branch April 27, 2026 14:06
danielmeppiel pushed a commit that referenced this pull request Apr 27, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
danielmeppiel pushed a commit that referenced this pull request Apr 27, 2026
Folds in #722/#790 marketplace authoring CLI and #989 cowork test fixup
that landed after the initial release branch was opened.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
danielmeppiel pushed a commit that referenced this pull request Apr 27, 2026
Promotes [Unreleased] to [0.10.0] - 2026-04-27. Each PR since v0.9.4
gets one 'so what' line:

- #926 Microsoft 365 Cowork target ships impl
- #790 marketplace authoring CLI (init, package add/set, build, check,
  outdated, doctor, publish) -- collapsed from 20+ bullets to one
- #722 marketplace plugin -> package rename + --help sectioning -- collapsed
- #980 README 'Coming from npx skills add' conversion block
- #981 docs auto-deploy on tag push (real fix for the #953 attempt)
- #985 pr-description-skill evals suite
- #984 pr-description-skill mermaid hardening
- #989 cowork sys.platform mock for Windows CI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants