Skip to content

test(cli): fast fixtures for scan-format argparse tests + fix doubled scripts path (refs #271) - #284

Merged
Wolfvin merged 1 commit into
mainfrom
fix/issue-271c-test-design
Jul 14, 2026
Merged

test(cli): fast fixtures for scan-format argparse tests + fix doubled scripts path (refs #271)#284
Wolfvin merged 1 commit into
mainfrom
fix/issue-271c-test-design

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Fixes the test-design subset of #271 (Group C + the path-bug from Group D). These are test-only fixes — no product code changed.

Fixes

1 & 2. TestArgparseFormatConflictRegression::test_scan_with_format_{long,short}_does_not_crash

The tests ran codelens scan . --format json / -f json via subprocess with timeout=60. . resolved to the real scripts/ dir, so scanning the whole codebase exceeded 60s and the subprocess timed out. The test's only purpose is to verify argparse does not raise a --format/-f conflict — it does not need a real codebase.

Fix: point the scan at a tiny throwaway tempfile.mkdtemp() workspace containing one trivial .py file, cleaned up in finally with shutil.rmtree(..., ignore_errors=True). Same argparse path exercised; assertions unchanged ("argparse.ArgumentError" not in stderr, "conflicting option string" not in stderr).

3. TestDeepSingleInvocation::test_deep_unsupported_command_sets_hint

Built the subprocess path as the relative "scripts/codelens.py" with PYTHONPATH="scripts". When pytest runs from the scripts/ cwd this became scripts/scripts/codelens.pycan't open file ... No such file or directory.

Fix: use the absolute os.path.join(SCRIPT_DIR, "codelens.py") and PYTHONPATH=SCRIPT_DIR, mirroring every other subprocess invocation in the file. Resolves correctly regardless of cwd.

Before / after

Before (all 3 failing):

FAILED tests/test_cli.py::...::test_scan_with_format_long_does_not_crash  - subprocess.TimeoutExpired: ... timed out after 60 seconds
FAILED tests/test_cli.py::...::test_scan_with_format_short_does_not_crash - subprocess.TimeoutExpired: ... timed out after 60 seconds
FAILED tests/test_hybrid_engine.py::...::test_deep_unsupported_command_sets_hint - can't open file '...\scripts\scripts\codelens.py'

After (the 3 targeted tests):

...                                                                      [100%]
3 passed

Scope note

Closes only the test-design subset of #271. Two other failures remain in these files and are out of scope / pre-existing on main (untouched here):

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

… scripts path (refs #271)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@Wolfvin
Wolfvin merged commit ae66a97 into main Jul 14, 2026
1 of 7 checks passed
@Wolfvin
Wolfvin deleted the fix/issue-271c-test-design branch July 14, 2026 08:08
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