selftests: drv-net: make linters happy with our imports
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 selftests: drv-net: make linters happy with our imports
Linters are still not very happy with our __init__ files, which was pointed out in recent review (see Link).
We have previously started importing things one by one to make linters happy with the test files (which import from __init__). But __init__ file itself still makes linters unhappy.
To clean it up I believe we must completely remove the wildcard imports, and assign the imported modules to __all__.
hds.py needs to be fixed because it seems to be importing the Python standard random from lib.net.
We can't use ksft_pr() / ktap_result() in case importing from net.lib fails. Linters complain that those helpers themselves may not have been imported.
---
- resend after net-next PR was merged
v1: https://lore.kernel.org/[email protected]
Sending a fix for the driver's __init__.py first, if this is okay with everyone I'll convert the rest. I'm not super confident 'cause my Python isn't properly learned.
Sending for net, even tho its not a real fix. I think that getting it applied during the merge window may be okay? No strong prefence. I'm slightly worried that merging it in net-next after the MW will leave us with a release cycle full of merge conflicts.
--- tools/testing/selftests/drivers/net/hds.py | 3 +- .../selftests/drivers/net/lib/py/__init__.py | 43 ++++++++++++++----- 2 files changed, 34 insertions(+), 12 deletions(-)
tools/testing/selftests/drivers/net/hds.py +2 -1
@@ -3,11 +3,12 @@ import errno import os +import random from typing import Union from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_raises, KsftSkipEx from lib.py import CmdExitFailure, EthtoolFamily, NlError from lib.py import NetDrvEnv -from lib.py import defer, ethtool, ip, random +from lib.py import defer, ethtool, ip def _get_hds_mode(cfg, netnl) -> str:
tools/testing/selftests/drivers/net/lib/py/__init__.py +32 -11
63 lines not on this page · raw message
Signature · 1 line
2.51.0
Paolo Abeni
maintainerQuoted 23 lines · Jakub Kicinski
Linters are still not very happy with our
__init__files, which was pointed out in recent review (see Link).We have previously started importing things one by one to make linters happy with the test files (which import from
__init__). But__init__file itself still makes linters unhappy.To clean it up I believe we must completely remove the wildcard imports, and assign the imported modules to
__all__.
hds.pyneeds to be fixed because it seems to be importing the Python standard random from lib.net.We can't use
ksft_pr()/ktap_result()in case importing from net.lib fails. Linters complain that those helpers themselves may not have been imported.Signed-off-by Jakub Kicinski <[email protected]>---
- resend after net-next PR was merged
v1: https://lore.kernel.org/[email protected]
Quoted 8 lines
Sending a fix for the driver's
__init__.pyfirst, if this is okay with everyone I'll convert the rest. I'm not super confident 'cause my Python isn't properly learned.Sending for net, even tho its not a real fix. I think that getting it applied during the merge window may be okay? No strong prefence. I'm slightly worried that merging it in net-next after the MW will leave us with a release cycle full of merge conflicts.
AFAICS linters are indeed happy, and I agree this should go via net, to propagate the correct style ASAP on both trees.
Thanks,
Paolo
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Fri, 3 Oct 2025 09:47:48 -0700 you wrote:
Linters are still not very happy with our
__init__files, which was pointed out in recent review (see Link).We have previously started importing things one by one to make linters happy with the test files (which import from
__init__). But__init__file itself still makes linters unhappy.[...]
Here is the summary with links:
- [net,repost] selftests: drv-net: make linters happy with our imports
https://git.kernel.org/netdev/net/c/b615879dbfea
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html