Skip to content

Type-check the whole tests directory with pyright - #27

Draft
coretl wants to merge 1 commit into
mainfrom
pyright-tests
Draft

coretl wants to merge 1 commit into
mainfrom
pyright-tests

Conversation

@coretl

@coretl coretl commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Makes tox -e type-checking run pyright over the whole tests directory, not just src and tests/unit_tests/core/test_status_types.py, as suggested in review of bluesky#1473.

Before the change pyright reported 289 errors over src plus tests; it now reports 0, and the unit test count is unchanged (1015 passed, 2 skipped, 1 xfailed).

What changed

  • pyproject.toml: the pyright include lists tests instead of the single test file. CLAUDE.md gets the matching ad hoc command.
  • Test fixes: corrected annotations, casts and narrowing asserts where the test code was wrong or under-annotated.
  • 84 rule-specific # pyright: ignore[reportXxx] comments, no blanket ignores and no settings loosened. They fall into two groups: tests that deliberately pass a bad value to check a runtime error (reportArgumentType, reportCallIssue), and attributes or types that are only known at runtime, mostly Tango proxies and mocks (reportAttributeAccessIssue, reportInvalidTypeForm).

How to review

Start with the pyproject.toml and CLAUDE.md hunks, then skim the test diffs by directory. Each ignore names its rule, so grep for pyright: ignore to audit them.

AI Disclaimer

The code and this description were generated with AI and reviewed/tweaked by the author.

Add tests to the pyright include in the type-checking tox env, previously
only src and tests/unit_tests/core/test_status_types.py were checked.
Fix the errors this exposes with corrected annotations, casts and
narrowing, and use rule-specific pyright ignores where a test deliberately
passes a bad value or touches an untyped backend.

Assisted-by: Claude Opus 5.5
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