From: Tom Krizek Date: Wed, 13 Mar 2024 17:18:42 +0000 (+0100) Subject: Move conftest log initialization to conftest.py X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a3f632b4906d4cc06f1eabd1f54b42378ebfb99;p=thirdparty%2Fbind9.git Move conftest log initialization to conftest.py Initializing the conftest logging upon importing the isctest package isn't practical when there are standalone pieces which can be used outside of the testing framework, such as the asyncdnsserver module. (cherry picked from commit 673387c4d515ecd1dd5dd6d854e629907b914970) --- diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index 2f84bb108b6..ee792fb0a85 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -33,6 +33,9 @@ import isctest if sys.version_info[1] < 10: raise RuntimeError("Python 3.10 or newer is required to run system tests.") +isctest.log.init_conftest_logger() +isctest.log.avoid_duplicated_logs() + # ----------------------- Globals definition ----------------------------- XDIST_WORKER = os.environ.get("PYTEST_XDIST_WORKER", "") diff --git a/bin/tests/system/isctest/log/__init__.py b/bin/tests/system/isctest/log/__init__.py index 702a9562d03..228f69e5bfa 100644 --- a/bin/tests/system/isctest/log/__init__.py +++ b/bin/tests/system/isctest/log/__init__.py @@ -10,8 +10,10 @@ # information regarding copyright ownership. from .basic import ( + avoid_duplicated_logs, deinit_module_logger, deinit_test_logger, + init_conftest_logger, init_module_logger, init_test_logger, debug, diff --git a/bin/tests/system/isctest/log/basic.py b/bin/tests/system/isctest/log/basic.py index 41b5ee68a1f..41988e9cbca 100644 --- a/bin/tests/system/isctest/log/basic.py +++ b/bin/tests/system/isctest/log/basic.py @@ -54,10 +54,6 @@ def avoid_duplicated_logs(): logging.root.handlers.remove(handler) -init_conftest_logger() -avoid_duplicated_logs() - - def init_module_logger(system_test_name: str, testdir: Path): logger = logging.getLogger(system_test_name) logger.handlers.clear()