fix(test): patch sys.platform in cowork tests for Windows CI#988
Closed
sergio-sisternes-epam wants to merge 1 commit intomicrosoft:mainfrom
Closed
fix(test): patch sys.platform in cowork tests for Windows CI#988sergio-sisternes-epam wants to merge 1 commit intomicrosoft:mainfrom
sergio-sisternes-epam wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.platformin macOS/Linux auto-detection unit tests so Windows CI doesn’t short-circuit into thewin32branch. - Normalize the expanded
copilot_cowork_skills_dirconfig value withos.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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 mocksys.platform. On Windows CI the code enters thewin32branch first and returnsNonewithout ever reaching the~/Library/CloudStorageglob logic. Two additional tests (zero_tenant,no_cloud_storage) passed for the wrong reason (the Windows short-circuit happened to returnNone, matching the expected result).1 test in
test_config_command.py--os.path.expanduser("~/myskills")on Windows producesC:\Users\...\myskillswith a forward slash after the home directory, whileos.path.join(home, "myskills")uses the native backslash. The assertion failed because the strings differed.Fix
apm_cli.integration.copilot_cowork_paths.sys.platformto the intended OS ("darwin"for macOS,"linux"for Linux).set_copilot_cowork_skills_dirnow normalises the expanded path withos.path.normpathto 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.