-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(ruff): add pytest linting rule #2053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2053 +/- ##
=======================================
Coverage 52% 52%
=======================================
Files 61 61
Lines 7076 7076
=======================================
Hits 3657 3657
Misses 3419 3419 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enables pytest-style linting rules in the project by adding the "PT" rule group to Ruff's linting configuration. This enforcement led to automated fixes across test files to comply with pytest best practices, specifically around parameterized test formatting.
Changes:
- Added pytest linting rules ("PT") to Ruff configuration
- Refactored pytest.mark.parametrize decorators to use tuple syntax instead of string literals
- Replaced
assert Falsewithpytest.fail()for clearer test failure messages - Removed duplicate test cases
- Added PT011 to ignored rules for test files (overly broad exception matching)
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Added "PT" rule group and PT011 exception ignore for tests |
| supervision/detection/vlm.py | Replaced assert False with pytest.fail() in production code |
| test/**/*.py | Converted parametrize arguments from strings to tuples and removed duplicate test cases |
Comments suppressed due to low confidence (1)
test/dataset/formats/test_yolo.py:40
- A duplicate test case for single line with box was removed (the remaining case at lines 38-41 duplicates the removed one). However, this appears to be intentional cleanup. Verify that the removed test case at line 47 (which was marked as removed in the diff) didn't provide unique coverage compared to the remaining test at lines 38-41.
["0 0.5 0.5 0.2 0.2"],
False,
DoesNotRaise(),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request makes a minor update to the linting configuration in
pyproject.tomlby enabling an additional linting rule group."PT"to theselectlist in the[tool.ruff.lint]section to enable the corresponding linting rules.