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.
---
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
Simon Horman
reviewerQuoted 24 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]>---
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.
Quoted 4 lines
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.
It looks like we are off to a flying start on that front:
it seems this does not apply cleanly to net.
...