From 6e9e3b720889ef4f53870a3a8ee71bd1bb059bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bal=C3=A1=C5=BEik?= Date: Wed, 28 Jan 2026 18:49:34 +0100 Subject: [PATCH] Define __all__ in __init__.py files Fix ruff's F401 unused-import errors in these files. Also sort them with: ruff check --extend-select RUF022 --fix. (cherry picked from commit 2b9c5ccd77ac47097bf364b2d3aa51ac9e183a28) --- bin/tests/system/conftest.py | 2 +- bin/tests/system/isctest/__init__.py | 12 ++++++++++ .../system/isctest/hypothesis/__init__.py | 8 ++++--- bin/tests/system/isctest/log/__init__.py | 16 +++++++++++++ bin/tests/system/isctest/vars/__init__.py | 24 +++++++++++++------ pyproject.toml | 2 ++ 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index d43c0da484..932bbe5e56 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -256,7 +256,7 @@ def configure_algorithm_set(request): name = None else: name = mark.args[0] - isctest.vars.set_algorithm_set(name) + isctest.vars.algorithms.set_algorithm_set(name) @pytest.fixture(autouse=True) diff --git a/bin/tests/system/isctest/__init__.py b/bin/tests/system/isctest/__init__.py index c5e4fc0ed5..b1731f5cd5 100644 --- a/bin/tests/system/isctest/__init__.py +++ b/bin/tests/system/isctest/__init__.py @@ -25,3 +25,15 @@ from . import ( # pylint: disable=redefined-builtin # environment variables which might not be set at the time of import of the # `isctest` package. To use the marks, manual `import isctest.mark` is needed # instead. + +__all__ = [ + "check", + "hypothesis", + "instance", + "kasp", + "log", + "query", + "run", + "template", + "vars", +] diff --git a/bin/tests/system/isctest/hypothesis/__init__.py b/bin/tests/system/isctest/hypothesis/__init__.py index e4cda09629..7123496b53 100644 --- a/bin/tests/system/isctest/hypothesis/__init__.py +++ b/bin/tests/system/isctest/hypothesis/__init__.py @@ -9,7 +9,9 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# This ensures we're using a suitable hypothesis version. A newer version is -# required for FIPS-enabled platforms. - from . import settings, strategies + +__all__ = [ + "settings", + "strategies", +] diff --git a/bin/tests/system/isctest/log/__init__.py b/bin/tests/system/isctest/log/__init__.py index 45ec242e39..ea801b5bd6 100644 --- a/bin/tests/system/isctest/log/__init__.py +++ b/bin/tests/system/isctest/log/__init__.py @@ -23,3 +23,19 @@ from .basic import ( warning, ) from .watchlog import WatchLogFromHere, WatchLogFromStart + +__all__ = [ + "WatchLogFromHere", + "WatchLogFromStart", + "avoid_duplicated_logs", + "critical", + "debug", + "deinit_module_logger", + "deinit_test_logger", + "error", + "info", + "init_conftest_logger", + "init_module_logger", + "init_test_logger", + "warning", +] diff --git a/bin/tests/system/isctest/vars/__init__.py b/bin/tests/system/isctest/vars/__init__.py index 3fea2f345c..f1bdc21d72 100644 --- a/bin/tests/system/isctest/vars/__init__.py +++ b/bin/tests/system/isctest/vars/__init__.py @@ -12,18 +12,28 @@ import os from .. import log -from .algorithms import init_crypto_supported, set_algorithm_set +from . import algorithms, autoconf, basic, dirs, features, openssl, ports from .all import ALL -from .features import init_features -from .openssl import parse_openssl_config + +__all__ = [ + "ALL", + "algorithms", + "autoconf", + "basic", + "dirs", + "features", + "init_vars", + "openssl", + "ports", +] def init_vars(): """Initializes the environment variables.""" - init_features() - init_crypto_supported() - set_algorithm_set(os.getenv("ALGORITHM_SET")) - parse_openssl_config(ALL["OPENSSL_CONF"]) + features.init_features() + algorithms.init_crypto_supported() + algorithms.set_algorithm_set(os.getenv("ALGORITHM_SET")) + openssl.parse_openssl_config(ALL["OPENSSL_CONF"]) os.environ.update(ALL) log.debug("setting following env vars: %s", ", ".join([str(key) for key in ALL])) diff --git a/pyproject.toml b/pyproject.toml index bb87900d7e..6a8dc81bbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,8 @@ target-version = "py310" lint.select = [ # import order "I", + # sorted __all__ + "RUF022", # f-strings "UP031", "UP032",