Skip to content

test: enforce precise exception assertions across tests and examples - #794

Merged
kstonekuan merged 4 commits into
Hebbian-Robotics:mainfrom
rokkalababu-dotcom:test/precise-exception-assertions
Nov 16, 2026
Merged

kstonekuan merged 4 commits into
Hebbian-Robotics:mainfrom
rokkalababu-dotcom:test/precise-exception-assertions

Conversation

@rokkalababu-dotcom

@rokkalababu-dotcom rokkalababu-dotcom commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Strengthen existing exception assertions so tests verify the intended failure reason and cannot pass because an unrelated operation raised the same exception class.

Closes #790.

Changes

  • Enable Ruff PT010, PT011, PT012, PT014, PT016, PT028, PT030 and PT031.
  • Resolve all resulting findings, including the Build AI and Egosuite workspace examples.
  • Match meaningful fields or reasons in broad exception assertions, retaining existing detailed assertions where useful.
  • Move setup outside pytest.raises and isolate the failing operation while preserving context-manager cleanup, streaming behavior and assertions about prior successful results.

No production code or stored-data behavior changes. Existing PT018 remains enabled; PT017 remains outside this change as requested in #790 and tracked by #792. No tests were added merely to increase the test count.

Validation

Local checks on macOS with Python 3.14.6 and FFmpeg available, using the locked root environment and separate locked environments for each affected example:

  • .venv/bin/python -m ruff check . — passed.
  • .venv/bin/python -m ruff format --check . — passed.
  • .venv/bin/ty check — passed.
  • .venv/bin/python -m pytest tests -q — 2331 passed, 47 skipped; the root virtualenv scripts and FFmpeg were on PATH.
  • Build AI example colocated suite — 45 passed.
  • Egosuite example colocated suite — 63 passed.
  • Type checks for both affected examples against their own locked Python environments — passed.

The opt-in network and Docker runtime checks were not enabled.

Checklist

  • Strengthened existing outcome-focused tests and preserved cleanup.
  • Completed Ruff, formatting and type checks.
  • Ran the root and both affected example test suites.
  • No recordings, generated media, credentials, private URLs or runtime artifacts added.
  • Production behavior and stored-data compatibility unchanged; no user-facing documentation change is needed.

AI assistance

AI assistance was used to prepare the test changes, lint configuration and PR description, and to execute the listed local checks.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

Copy link
Copy Markdown

👋 Hi @rokkalababu-dotcom — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

💡 Tip: one open pull request per contributor at a time. Before starting an issue, check its sidebar for an assignee or a linked pull request. Either one means somebody is already on it; everything else is fair game.

We are excited to have you here and appreciate your help making the project better! 🙌

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge; no actionable issues were found.

Summary

This PR tightens exception checks without changing production code.

  • Tests now check the specific reason an operation failed.

No actionable issues were found. Tests and lint checks were not run during this review.

Reviews (1) · Last reviewed commit: "Strengthen Egosuite example exception as..." · Reviewed by Greptile

@kstonekuan kstonekuan 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.

LGTM, merging. 20 findings on main for these rules, 0 on your branch (both examples too), 2638 passed. Thanks!

@kstonekuan
kstonekuan merged commit 7460b76 into Hebbian-Robotics:main Nov 16, 2026
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.

Enable Ruff checks for precise exception assertions and fix all findings

2 participants