From: Štěpán Balážik Date: Wed, 28 Jan 2026 17:49:34 +0000 (+0100) Subject: Define __all__ in __init__.py files X-Git-Tag: v9.21.19~15^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b9c5ccd77ac47097bf364b2d3aa51ac9e183a28;p=thirdparty%2Fbind9.git 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. --- diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index a9c3fc47dfa..089d5ed52cb 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -260,7 +260,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 c5e4fc0ed54..b1731f5cd5c 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 e4cda096293..7123496b533 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 45ec242e399..ea801b5bd62 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 3fea2f345c7..82de02c75bd 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, basic, build, dirs, features, openssl, ports from .all import ALL -from .features import init_features -from .openssl import parse_openssl_config + +__all__ = [ + "ALL", + "algorithms", + "basic", + "build", + "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 bb87900d7e0..6a8dc81bbe6 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",