From af5ecee9b358035d8ec738f4446214c888684556 Mon Sep 17 00:00:00 2001
From: David Douard <david.douard@sdfa3.org>
Date: Thu, 17 Oct 2024 15:04:40 +0200
Subject: [PATCH] test: fix test_load_from_envvar

Make it immune to an existing SWH_CONFIG_FILENAME.
---
 swh/core/tests/test_config.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/swh/core/tests/test_config.py b/swh/core/tests/test_config.py
index 943320e..f927834 100644
--- a/swh/core/tests/test_config.py
+++ b/swh/core/tests/test_config.py
@@ -326,9 +326,9 @@ def test_merge_config_type_error():
             config.merge_configs({"a": {}}, {"a": v})
 
 
-def test_load_from_envvar_no_environment_var_swh_config_filename_set():
+def test_load_from_envvar_no_environment_var_swh_config_filename_set(monkeypatch):
     """Without SWH_CONFIG_FILENAME set, load_from_envvar raises"""
-
+    monkeypatch.delenv("SWH_CONFIG_FILENAME", raising=False)
     with pytest.raises(AssertionError, match="SWH_CONFIG_FILENAME environment"):
         config.load_from_envvar()
 
-- 
GitLab