From 117a72dac398519d584faceed22c3dcdc26183e5 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 20 Feb 2026 17:06:55 +0000 Subject: [PATCH] test: fail fast when CHATMAIL_DOMAIN is unset This code does not expect the variable to be unset, so use indexing to fail with KeyError instead. Otherwise getenv() returns None which is then converted to "none" string by formatting and the test only fails because of connection attempts to "none" domain. --- deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py index 9920e8224c..7ee8e61e38 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py @@ -54,13 +54,13 @@ def get_unconfigured_bot(self) -> Bot: def get_credentials(self) -> (str, str): """Generate new credentials for chatmail account.""" - domain = os.getenv("CHATMAIL_DOMAIN") + domain = os.environ["CHATMAIL_DOMAIN"] username = "ci-" + "".join(random.choice("2345789acdefghjkmnpqrstuvwxyz") for i in range(6)) return f"{username}@{domain}", f"{username}${username}" def get_account_qr(self): """Return "dcaccount:" QR code for testing chatmail relay.""" - domain = os.getenv("CHATMAIL_DOMAIN") + domain = os.environ["CHATMAIL_DOMAIN"] return f"dcaccount:{domain}" @futuremethod