Repository navigation
Fix the ruff errors in the tests - #2939
Merged
Merged
Conversation
The tests are excluded from ruff's lint settings, so these weren't reported. Fix all 79: - Remove 22 unused imports (none were fixtures). - Replace `from arcade.math import *` in test_math.py with the names it uses. test_arcade.py keeps its star import, which is what it tests. - Unused variables: drop assignments that only checked a call raised or worked; use `del` in the GC test, which drops references on purpose; remove ones only used by commented out code; mark the annotated assignments in test_spritesequence.py that check types. - test_event_order.py defined two handlers named `record_window`, so the test removed the release handler as the press handler, and neither was removed from the shared window. Name them apart and remove both. - Wrap long lines, fix two invalid escape sequences, `not in`, and an `== False` comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all 79 ruff errors in
tests/. The tests are in ruff'slint.excludeinpyproject.toml, so CI never reported these. They only show when you runruff check tests.ruff --fix. I checked every removed line: none were fixtures, which ruff can't see being used.test_math.py: replacedfrom arcade.math import *with the 12 names it uses.test_arcade.py: kept, with# noqa: F403, since checking whatfrom arcade import *gives you is what that test does.not in, and== False→is False.Unused variables, decided case by case:
pytest.raisesblocks, or that only checked a call works: dropped the assignment and kept the call.test_gl_gc.py: it holds a reference on purpose, then drops it with= Noneto trigger garbage collection. That's nowdel, which says the same thing more clearly.test_spritesequence.py: two annotated assignments are deliberate type checks (# assert_type), so they're marked withnoqa.A real problem in
test_event_order.py: the test defined two window handlers both namedrecord_window, so the second replaced the first. At the end,window.remove_handler("on_mouse_press", record_window)passed the release handler, which pyglet silently ignores ("No error is raised if any handler does not appear"). So neither handler was removed from the window that later tests share. They now have distinct names, and both are removed.Checks
ruff check tests: all checks pass.ruff format: the two files I edited are formatted. Two other test files were already unformatted ondevelopment(test_ubo_stress.py,image_compare.py), and I left them alone.No library code changes, so there's no changelog entry.
Possible follow-up: removing
"tests"fromlint.excludewould make CI lint the tests from now on, so they stay clean. I left that out, since it's a project decision.🤖 Generated with Claude Code