Skip to content

test(bundle): join across wrap points in the build output-path assertion - #4280

Open
SEPURI-SAI-KRISHNA wants to merge 1 commit into
github:mainfrom
SEPURI-SAI-KRISHNA:test/bundle-cli-wrap
Open

test(bundle): join across wrap points in the build output-path assertion#4280
SEPURI-SAI-KRISHNA wants to merge 1 commit into
github:mainfrom
SEPURI-SAI-KRISHNA:test/bundle-cli-wrap

Conversation

@SEPURI-SAI-KRISHNA

@SEPURI-SAI-KRISHNA SEPURI-SAI-KRISHNA commented Aug 22, 2026

Copy link
Copy Markdown

Description

tests/contract/test_bundle_cli.py::test_build_escapes_markup_in_output_path
fails or passes depending on how long the runner's temp directory path is.

The bundle build success line prints an absolute path. Rich folds it at the
console width, and when the fold lands inside the asserted token the substring
check misses:

E   AssertionError: the reported path must match the directory actually written
E   assert 'dist[bold]out' in '✓ Built demo-bundle-1.2.0.zip (2 files) →
E   /tmp/pytest-of-runner/pytest-1/test_build_escapes_markup_in_o0/dist[bo
E   ld]out/demo-bundle-1.2.0.zip\n'

Reproduced on a clean checkout of main (27f50f7): fails under the default
--basetemp, passes under a --basetemp 60 characters longer, because the
wrap point moves. Nothing about the escaping under test changes — only where
the line breaks.

Fix

Join across the wrap points before the substring check, the same normalization
#4166 applied to the analogous presets assertion:

assert "dist[bold]out" in "".join(strip_ansi(result.output).split())

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

Full suite on this branch: 7137 passed, 181 skipped on Linux / Python 3.14.
On main the same run is 7136 passed, 1 failed -- the failure being this test.

tests/contract/test_bundle_cli.py on its own: 44 passed, under both the
default --basetemp (which fails on main) and a deliberately long one.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

Code generated with Claude Code. I reviewed the change, confirmed it fails on
main under the default --basetemp, and understand what it does.

Copilot AI balanced review requested due to automatic review settings August 22, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes the bundle CLI contract test deterministic across Rich console wrap points.

Changes:

  • Normalizes whitespace before checking the escaped output path.
  • Documents why normalization is necessary.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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