From 7dee94444f3f542d676166915ceb98bc173790c3 Mon Sep 17 00:00:00 2001 From: Marlon Costa Date: Sun, 6 Dec 2026 12:17:18 -0300 Subject: [PATCH] fix(tests): restore the prior YAML configuration environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reuse the public Tests environment scope so CFG_ENGINE_HOME is restored after YAML loading. Preserve every existing assertion and the real configuration path. Sonar: python:S8997 / AZ_ZM2s-Rt4gBeCJ9r1W Author: Marlon Costa — Datacosmos. --- tests/unit/test_config_engine.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/unit/test_config_engine.py b/tests/unit/test_config_engine.py index ea0b87c5..180c46d4 100644 --- a/tests/unit/test_config_engine.py +++ b/tests/unit/test_config_engine.py @@ -264,11 +264,8 @@ def test_config_load_yaml_expands_env(tmp_path: Path) -> None: """Verify that config load yaml expands env.""" source = tmp_path / "app.yaml" source.write_text("path: ${CFG_ENGINE_HOME}/data\n", encoding="utf-8") - os.environ["CFG_ENGINE_HOME"] = "/eng" - try: + with u.Tests.env_vars_context({"CFG_ENGINE_HOME": "/eng"}): result = u.Cli.config_load(source) - finally: - os.environ.pop("CFG_ENGINE_HOME", None) tm.ok(result) doc = result.unwrap() tm.that(doc, is_=m.ConfigDocument)