Skip to content

test: extract shared _runner_aliased_attrs helper in test_runner.py - #307

Merged
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-82kyra
Aug 29, 2026
Merged

test: extract shared _runner_aliased_attrs helper in test_runner.py#307
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-82kyra

Conversation

@dhruvbatra

@dhruvbatra dhruvbatra commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • _build_runner and _build_visualize_override_runner in tests/test_runner.py each built the same byte-identical six-key alias dict (browser_manager/browser, claim_verifier/verifier, artifact_manager/artifacts) for instantiate_with_aliased_attrs(VisualQARunner, ...).
  • Hoisted it into a single _runner_aliased_attrs(browser, verifier, artifacts) helper both builders now call, matching this file's established convention of factoring out duplicated test scaffolding (_skip_preflight, _claim_event_recorder, etc. — see test: extract shared _skip_preflight helper in test_runner.py #304).
  • No behavior change: same dict contents, same call sites.

Test plan

  • uv run pytest tests/test_runner.py -q — 43 passed
  • uv run pytest tests/ -q — 326 passed, 21 failed (pre-existing Chromium-sandbox environment failures in test_browser.py/test_live_runner.py, same baseline as before this change)
  • uv run ruff check src/ tests/ — clean
  • uv run ruff format --check tests/test_runner.py — clean (confirmed pre-existing drift in other, untouched files via ruff format --check src/ tests/)

🤖 Generated with Claude Code


Generated by Claude Code


Note

Low Risk
Only test scaffolding in test_runner.py; no application code or runtime behavior changes.

Overview
Test-only refactor in tests/test_runner.py: the identical six-key alias dict passed to instantiate_with_aliased_attrs(VisualQARunner, …) is no longer duplicated in _build_runner and _build_visualize_override_runner.

A new _runner_aliased_attrs(browser, verifier, artifacts) helper returns that map (current names plus legacy aliases: browser/browser_manager, verifier/claim_verifier, artifacts/artifact_manager). Both builders now call it instead of inlining the dict.

No production or runner behavior change—same wiring for tests that construct VisualQARunner with fakes.

Reviewed by Cursor Bugbot for commit d9338d7. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Refactor
    • Streamlined internal test-runner setup by centralizing shared configuration.
    • No changes to exported functionality or end-user behavior.

_build_runner and _build_visualize_override_runner each built the same
byte-identical six-key alias dict (browser_manager/browser,
claim_verifier/verifier, artifact_manager/artifacts) for
instantiate_with_aliased_attrs(VisualQARunner, ...). Hoisted it to a
single _runner_aliased_attrs helper both builders now call, matching
this file's established convention of factoring out duplicated test
scaffolding (_skip_preflight, _claim_event_recorder, etc.).

Co-authored-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ea795b0-c8f0-47fe-908a-724d7b65b4ce

📥 Commits

Reviewing files that changed from the base of the PR and between f6495e7 and d9338d7.

📒 Files selected for processing (1)
  • tests/test_runner.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The test runner setup now centralizes current and legacy constructor aliases in _runner_aliased_attrs. Both runner-building helpers reuse this mapping.

Changes

Runner alias mapping

Layer / File(s) Summary
Centralize and apply runner aliases
tests/test_runner.py
The private _runner_aliased_attrs helper defines browser, verifier, and artifact aliases. _build_runner and _build_visualize_override_runner reuse the helper.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to d9338

This change consolidates duplicated test setup without changing application behavior or the dependencies supplied to the runner tests. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: juanpin

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: extracting the shared _runner_aliased_attrs helper in test_runner.py.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/admiring-hawking-82kyra

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dhruvbatra
dhruvbatra merged commit eaea8f5 into main Aug 29, 2026
3 of 5 checks passed
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