test(cache-conf): isolate the env the handler reads through setdefault

0d2fadce0c simplified this test and dropped the env patch the old one carried. EnvBuilder.setdefault keeps whatever os.environ already holds, and the test container injects INFINITO_CACHE_PACKAGE_FRONTEND_CONF through BASH_ENV, so the assertion compared the worktree path against its own temp directory and only failed inside the container.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-04 00:52:29 +02:00
1 parent 1138acf441
commit e583c3eeb2
1 file changed
+3
@@ -2,9 +2,11 @@
from __future__ import annotations
import os
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
from utils.env.builder import BuildContext, EnvBuilder
from utils.env.handlers.infinito.cache import conf as handler
@@ -26,6 +28,7 @@ class TestApply(unittest.TestCase):
self.addCleanup(self._tmp.cleanup)
self.root = Path(self._tmp.name).resolve()
@patch.dict(os.environ, {handler.KEY: ""}, clear=False)
def test_the_map_is_rendered_in_the_checkout_that_builds_it(self) -> None:
eb = EnvBuilder()