Files
ThothII/harness/tests/test_cli_config_environment.py

21 lines
599 B
Python

import os
from importlib import reload
from pathlib import Path
def test_cli_default_config_honors_tht_config(monkeypatch):
from tht.cli import config_cmd
previous = os.environ.get("THT_CONFIG")
try:
monkeypatch.setenv("THT_CONFIG", "/app/harness/config/tht.yaml")
reload(config_cmd)
assert config_cmd.CONFIG_OPT.default == Path("/app/harness/config/tht.yaml")
finally:
if previous is None:
monkeypatch.delenv("THT_CONFIG", raising=False)
else:
monkeypatch.setenv("THT_CONFIG", previous)
reload(config_cmd)