Uh oh!
There was an error while loading. Please reload this page.
gh-120417: Add #noqa to load_tests() in tests - #120626
Conversation
encukou
commented
Jun 17, 2024
Could you add/link an explanation about what In my projects, I've avoided these warning by adding public names to |
vstinner
commented
Jun 17, 2024
It's a "standard" linter command to ignore "imported but unused" warning on the current line. It was discussed at #120421. |
serhiy-storchaka
commented
Jun 17, 2024
Could you add an exception for |
vstinner
commented
Jun 17, 2024
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. |
serhiy-storchaka
commented
Jun 17, 2024
Can it be ignored for |
AlexWaygood
commented
Jun 17, 2024
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. |
vstinner
commented
Jun 19, 2024
In total, |
Ignore linter "imported but unused" warnings in tests when the linter doesn't understand why the import is important.