Skip to content

test(ci): normalize setup overwrite assertion#898

Merged
phernandez merged 1 commit into
mainfrom
codex/fix-windows-ci-output-assertion
Jun 7, 2026
Merged

test(ci): normalize setup overwrite assertion#898
phernandez merged 1 commit into
mainfrom
codex/fix-windows-ci-output-assertion

Conversation

@phernandez
Copy link
Copy Markdown
Member

Summary

  • normalize whitespace in the CI setup overwrite assertion so Windows console wrapping does not fail the test

Verification

  • uv run pytest tests/cli/test_ci_commands.py::test_setup_does_not_partially_write_generated_files_when_target_exists -q
  • uv run ruff check tests/cli/test_ci_commands.py

Signed-off-by: phernandez <paul@basicmachines.co>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

Claude finished @phernandez's task in 48s —— View job


PR Review

  • Gather context
  • Review the change
  • Post review findings

Summary

This is a minimal, focused fix to make a CI test assertion resilient to Windows console line-wrapping. The change is correct and addresses an explicit item in our team checklist.

The Problem

The error message tested is generated in src/basic_memory/cli/commands/ci.py:386 and ci.py:391:

raise ValueError(f"{path} already exists; pass --force to overwrite")

On Windows, {path} is an absolute Windows path (e.g. C:\Users\runner\AppData\Local\Temp\pytest-xxx\...), which can be long enough to cause the console renderer to wrap the output line. When wrapped, result.output contains a newline in the middle of the phrase, so a literal in result.output check fails.

The Fix

# Before
assert "pass --force to overwrite" in result.output

# After
assert "pass --force to overwrite" in " ".join(result.output.split())

str.split() with no arguments splits on all whitespace (spaces, tabs, \n, \r\n), and rejoining with a single space produces a single-line string. This is the idiomatic, most robust approach — it handles both Unix and Windows line endings without needing to enumerate them explicitly.


Checklist

Item Status
Follows Basic Memory coding conventions
Python 3.12+ type annotations / async patterns ✅ N/A (test-only change)
100-character line length maintained
No commented-out code
Test coverage maintained ✅ (this is a test fix)
File path comparisons must be Windows-compatible ✅ Directly addressed
No emojis/unicode in console output ✅ N/A
No hardcoded secrets or credentials

Verdict

Approved. The change is correct, minimal, and directly resolves the Windows CI flakiness. No issues found.

@phernandez phernandez merged commit 1667cdc into main Jun 7, 2026
25 checks passed
@phernandez phernandez deleted the codex/fix-windows-ci-output-assertion branch June 7, 2026 04:20
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