Skip to content

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

Closed
sergio-sisternes-epam wants to merge 1 commit intomicrosoft:mainfrom
sergio-sisternes-epam:fix/cowork-windows-ci
Closed

fix(test): patch sys.platform in cowork tests for Windows CI#988
sergio-sisternes-epam wants to merge 1 commit intomicrosoft:mainfrom
sergio-sisternes-epam: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 C:\Users\...\myskills with a forward slash after the home directory, while os.path.join(home, "myskills") uses the native backslash. 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 regressions for the experimental Copilot Cowork integration by making platform-specific tests deterministic across runners and normalizing a stored config path to avoid mixed path separators on Windows.

Changes:

  • Patch sys.platform in macOS/Linux auto-detection unit tests so Windows CI doesn’t short-circuit into the win32 branch.
  • Normalize the expanded copilot_cowork_skills_dir config value with os.path.normpath() to avoid separator mismatches 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-specific resolver tests execute the intended OS branch consistently on all CI runners by patching sys.platform.
src/apm_cli/config.py Normalizes expanded cowork skills directory paths to produce consistent absolute paths across platforms (notably Windows).

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.

2 participants