-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-120417: Add #noqa to load_tests() in tests #120626
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
Could you add/link an explanation about what In my projects, I've avoided these warning by adding public names to |
It's a "standard" linter command to ignore "imported but unused" warning on the current line. It was discussed at #120421. |
Could you add an exception for |
I have no idea on how to do that. @AlexWaygood: Is it something supported by Ruff by example? |
we support ignoring certain errors for filenames that match certain patterns. But I don't think we support ignoring F401 for specific symbols, no. It might be a reasonable feature request. |
Can it be ignored for |
Yes, in Ruff you can do that via the CLI using [tool.ruff.lint.per-file-ignores]
"Lib/test/*/**/__main__.py" = ["F401"] Or this in a [lint.per-file-ignores]
"Lib/test/*/**/__main__.py" = ["F401"] |
It means that other unused imports can no longer be catched. |
In total, |
Ignore linter "imported but unused" warnings in tests when the linter doesn't understand why the import is important.