Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: net: py: capitalize defer queue and improve import

Import utils and refer to the global defer queue that way instead
of importing the queue. This will make it possible to assign value
to the global variable. While at it capitalize the name, to comply
with the Python coding style.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/20260108225257.2684238-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+6 -6
+4 -4
tools/testing/selftests/net/lib/py/ksft.py
··· 8 8 import traceback 9 9 from collections import namedtuple 10 10 from .consts import KSFT_MAIN_NAME 11 - from .utils import global_defer_queue 11 + from . import utils 12 12 13 13 KSFT_RESULT = None 14 14 KSFT_RESULT_ALL = True ··· 157 157 global KSFT_RESULT 158 158 159 159 i = 0 160 - qlen_start = len(global_defer_queue) 161 - while global_defer_queue: 160 + qlen_start = len(utils.GLOBAL_DEFER_QUEUE) 161 + while utils.GLOBAL_DEFER_QUEUE: 162 162 i += 1 163 - entry = global_defer_queue.pop() 163 + entry = utils.GLOBAL_DEFER_QUEUE.pop() 164 164 try: 165 165 entry.exec_only() 166 166 except Exception:
+2 -2
tools/testing/selftests/net/lib/py/utils.py
··· 141 141 return self.process(terminate=terminate, fail=self.check_fail) 142 142 143 143 144 - global_defer_queue = [] 144 + GLOBAL_DEFER_QUEUE = [] 145 145 146 146 147 147 class defer: ··· 153 153 self.args = args 154 154 self.kwargs = kwargs 155 155 156 - self._queue = global_defer_queue 156 + self._queue = GLOBAL_DEFER_QUEUE 157 157 self._queue.append(self) 158 158 159 159 def __enter__(self):