[Feature]: type check tests/, the last ignore_errors block
Maintainers usually reply within 1 day
@NaCr05 is already working on this.
Since Oct 29, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- developer-experience, testing
Research direction
Start by examining pyproject.toml to locate the ignore_errors block for tests. The immediate blocker is in tests/annotators/test_utils.py line 142, which imports via src. You'll need to decide whether to exclude that file or refactor the import using importlib. Then, run mypy on individual test directories (like validators/, geometry/) to see the errors, focusing on the error types listed (arg-type, attr-defined, union-attr, type-arg). Add type annotations to test functions if disallow_untyped_defs is kept. Done when mypy passes on the test directories you've cleared, and the ignore_errors block for tests.* is removed.
Written by the indexing model from the issue text.
Description
Search before asking
- I have searched the issues and discussions and found no similar feature request.
Feature Description
What: drop tests.* from the ignore_errors overrides in pyproject.toml so the test suite gets type checked too.
Why: #2091 set mypy up with examples.* and tests.* exempt, and the source side has been cleared out since (#2172 was the last of those). tests.* is the only block left. so here's what it actually costs, rather than guessing.
measured at 0080df0 with mypy 2.3.1 and the flags the pre-commit hook actually passes (--ignore-missing-imports --scripts-are-modules), each directory on its own with --follow-imports=silent. the source-only control comes back Success: no issues found in 90 source files, so none of this is my environment.
| directory | strict | without disallow_untyped_defs |
|---|---|---|
validators/ |
0 | 0 |
geometry/ |
2 | 1 |
classification/ |
4 | 4 |
cv2/ |
5 | 5 |
| root files | 10 | 9 |
draw/ |
21 | 21 |
annotators/ |
125 | 30 |
utils/ |
130 | 65 |
dataset/ |
150 | 140 |
key_points/ |
183 | 84 |
metrics/ |
219 | 103 |
detection/ |
332 | 307 |
| whole tree | 1192 | 780 |
there are two things i'd rather get your call on before writing any code.
there's a blocker you hit immediately. tests/annotators/test_utils.py:142 does from src.supervision.draw.color import ColorPalette, inside a test whose entire point is that the src namespace resolves. with mypy_path = src, mypy sees src/supervision/draw/color.py under two module names and gives up on the whole run:
error: Source file found twice under different module names:
"supervision.draw.color" and "src.supervision.draw.color"
that's a module resolution error, not a line one, so # type: ignore does nothing for it. you either exclude that one file or reach the src namespace through importlib so mypy only ever sees one path. the second keeps the test meaningful but does change what it asserts, so it's your call. every number in the table above has that file excluded.
and one flag decides half the work. 565 of the 1192 are no-untyped-def, which is just -> None on test functions. it's most of the diff and it doesn't catch anything. the rest is the part that's actually worth having:
156 arg-type
157 attr-defined (mostly pytest.raises and mock.patch context managers)
106 union-attr
76 type-arg (bare ndarray)
so, full strict on tests, or strict minus disallow_untyped_defs for tests.*? happy either way, i'd just rather agree it once than change my mind about it five directories in.
if you want this at all, validators/ is already clean and the next four are all under 25, so it can go in small increments the same way the source exemptions did.
Are you willing to submit a PR?
- Yes I'd like to help by submitting a PR!
- Dominant language
- Python
- Stars
- 51.6k
- Forks
- 5k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 191
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from roboflow/supervision
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
roboflow/supervision#2971 ·
Maintainers usually reply within 1 day
-
[Bug]: DetectionDataset.split loses a train item when len(images) * split_ratio is a whole number (90 images at 0.7 give 62/28, not 63/27)Possibly taken @avanish-garg claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
roboflow/supervision#2968 ·
Maintainers usually reply within 1 day
-
[Bug]: MeanAverageRecall returns 0.0 instead of -1 when there are no targets (whole run or empty size bucket)Possibly taken @MaiAditya claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
roboflow/supervision#2964 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
roboflow/supervision#2950 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 56/100
roboflow/supervision#2938 · 2 comments ·
Maintainers usually reply within 1 day
All issues in roboflow/supervision
Similar issues
-
area:core-platform effort:S priority:P3 risk:night-safe status:ready type:test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
randomparity/kdive#3620 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FinanceFlash/unvibecode#760 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
google-research/google-research#3470 ·
Maintainers usually reply within 21 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
mrvautin/ha-workouts#11 ·