Skip to content

test: extract shared _skip_preflight helper in test_runner.py - #304

Merged
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-w85tbj
Aug 26, 2026
Merged

test: extract shared _skip_preflight helper in test_runner.py#304
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-w85tbj

Conversation

@dhruvbatra

@dhruvbatra dhruvbatra commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Issue

_build_runner and _build_visualize_override_runner in tests/test_runner.py each defined a byte-for-byte identical local async no-op closure:

async def _skip_preflight(url: str) -> None:
    del url
    return None

used to stub out VisualQARunner._preflight_url so tests don't make a real HTTP HEAD probe. Neither call site's assignment relies on closure identity or a fresh object per call — both just attach the same no-op coroutine to a fresh runner instance.

Improvement

Hoisted _skip_preflight to a single module-level function; both builders now assign that shared function instead of each redefining it. This matches the file's established convention for factoring out duplicated test scaffolding (_build_* fixture builders, _make_response, _check_messages, patched_sleep, etc. — see prior PRs #167, #200, #221, #237 in this repo).

Test-only, single file, +6/-8.

Safety / Verification

  • uv run ruff check src/ tests/ — clean
  • uv run ruff format --check tests/test_runner.py — already formatted
  • uv run pytest tests/test_runner.py — 43 passed (same as before the change)
  • uv run pytest tests/326 passed / 21 failed, identical to the documented pre-existing baseline (the 21 failures are all environment-only Chromium-sandbox tests in test_browser.py/test_live_runner.py — same test names, unchanged by this diff)
  • No behavior change: both call sites end up with the exact same coroutine object attached to runner._preflight_url as before, just defined once instead of twice.

Generated by Claude Code


Note

Low Risk
Test scaffolding only; no production code or test behavior change.

Overview
Test-only refactor in tests/test_runner.py: the identical no-op async stub used to bypass VisualQARunner._preflight_url (HTTP HEAD) is defined once at module scope as _skip_preflight, with a short docstring.

_build_runner and _build_visualize_override_runner no longer each define a local _skip_preflight; both still assign that shared coroutine to runner._preflight_url (setattr vs direct attribute assignment unchanged). Runtime behavior in tests is the same—only duplication is removed, aligned with other shared _build_* helpers in this file.

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

Summary by CodeRabbit

  • Refactor
    • Consolidated duplicated test setup logic into a shared helper.
    • No user-facing behavior or exported interfaces were changed.

_build_runner and _build_visualize_override_runner each defined a
byte-identical local async no-op _skip_preflight(url) closure used to
stub out VisualQARunner._preflight_url for tests. Hoisted it to a
single module-level function that both builders now reference,
matching this file's established convention of factoring out
duplicated test scaffolding (_build_* fixtures, _make_response,
_check_messages, etc.).
@coderabbitai

coderabbitai Bot commented Aug 26, 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: edb3b9a7-a9d8-4489-a93b-fb8856d533b1

📥 Commits

Reviewing files that changed from the base of the PR and between d95c305 and f2f7873.

📒 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

Changes

Runner preflight setup

Layer / File(s) Summary
Share the preflight no-op
tests/test_runner.py
Adds a module-level asynchronous _skip_preflight helper. Both runner-building helpers assign it to runner._preflight_url, with behavior unchanged.

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

Merge Risk: ⚪ Minimal · up to f2f78

This is a localized test-only refactor with no behavior change, and no actionable merge-blocking risk remains beyond 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 50.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 _skip_preflight helper in tests/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-w85tbj

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 cd6d17b into main Aug 26, 2026
4 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