From dbe059c5457da8072f7604bac8e60195622da5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Fri, 10 May 2024 13:10:14 +0200 Subject: [PATCH] Initialize all environment variables when running isctest Ensure all the variables are initialized when running the main function of isctest module. This enables proper environment variables during test script development when only conf.sh is sourced, rather than the script being executed by the pytest runner. (cherry picked from commit d7ace928b5e9520b0b68169abef43be3f6d50a0c) --- bin/tests/system/isctest/__main__.py | 9 ++++++++- bin/tests/system/isctest/log/basic.py | 1 - bin/tests/system/isctest/vars/algorithms.py | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/isctest/__main__.py b/bin/tests/system/isctest/__main__.py index 2b82a81d46..d1be74c727 100644 --- a/bin/tests/system/isctest/__main__.py +++ b/bin/tests/system/isctest/__main__.py @@ -9,9 +9,16 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from .vars import ALL +import logging + +from . import log +from .vars import ALL, init_vars if __name__ == "__main__": + # use root logger as fallback - we're not interested in proper logs here + log.basic.LOGGERS["conftest"] = logging.getLogger() + + init_vars() for name, value in ALL.items(): print(f"export {name}={value}") diff --git a/bin/tests/system/isctest/log/basic.py b/bin/tests/system/isctest/log/basic.py index b3987b27f9..67121d2e24 100644 --- a/bin/tests/system/isctest/log/basic.py +++ b/bin/tests/system/isctest/log/basic.py @@ -14,7 +14,6 @@ from pathlib import Path from typing import Dict, Optional -CONFTEST_LOGGER = logging.getLogger("conftest") LOG_FORMAT = "%(asctime)s %(levelname)7s:%(name)s %(message)s" LOGGERS = { diff --git a/bin/tests/system/isctest/vars/algorithms.py b/bin/tests/system/isctest/vars/algorithms.py index 56f3edc62c..26bcc579f8 100644 --- a/bin/tests/system/isctest/vars/algorithms.py +++ b/bin/tests/system/isctest/vars/algorithms.py @@ -129,9 +129,11 @@ def is_crypto_supported(alg: Algorithm) -> bool: cwd=tmpdir, check=False, stdout=subprocess.DEVNULL, + stderr=subprocess.PIPE, ) if proc.returncode == 0: return True + log.debug(f"dnssec-keygen stderr: {proc.stderr.decode('utf-8')}") log.info("algorithm %s not supported", alg.name) return False