From ac7c657d191edbf7061b2620a4a511f51661213b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Mon, 6 May 2024 16:55:42 +0200 Subject: [PATCH] Move isctest.var initialization to conftest.py The environment variable initialization requires logging to be set up first. Ensure the initialization is delayed until loggers have been set up. --- bin/tests/system/conftest.py | 1 + bin/tests/system/isctest/vars/__init__.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index 77b1948eaf..5585d1e402 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -33,6 +33,7 @@ from isctest.vars.dirs import SYSTEM_TEST_DIR_GIT_PATH isctest.log.init_conftest_logger() isctest.log.avoid_duplicated_logs() +isctest.vars.init_vars() # ----------------- Older pytest / xdist compatibility ------------------- # As of 2023-01-11, the minimal supported pytest / xdist versions are diff --git a/bin/tests/system/isctest/vars/__init__.py b/bin/tests/system/isctest/vars/__init__.py index d4e26a892f..7c06a247a2 100644 --- a/bin/tests/system/isctest/vars/__init__.py +++ b/bin/tests/system/isctest/vars/__init__.py @@ -16,8 +16,9 @@ from .openssl import parse_openssl_config from .. import log -# env variable initialization -parse_openssl_config(ALL["OPENSSL_CONF"]) +def init_vars(): + """Initializes the environment variables.""" + parse_openssl_config(ALL["OPENSSL_CONF"]) -os.environ.update(ALL) -log.debug("setting following env vars: %s", ", ".join([str(key) for key in ALL])) + os.environ.update(ALL) + log.debug("setting following env vars: %s", ", ".join([str(key) for key in ALL]))