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 d7ace928b5)
This commit is contained in:
Nicki Křížek 2024-05-10 13:10:14 +02:00
parent 257730f30b
commit dbe059c545
No known key found for this signature in database
GPG key ID: 01623B9B652A20A7
3 changed files with 10 additions and 2 deletions

View file

@ -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}")

View file

@ -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 = {

View file

@ -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