From 95fcdb3465dc9acfc407777ffa7f3d5156bb85a7 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Sat, 17 Oct 2026 07:27:15 -0700 Subject: [PATCH] test(api): canonicalize portable temporary gallery roots (#194) --- tests/test_output_dir.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_output_dir.py b/tests/test_output_dir.py index aebb3a0..3d64332 100644 --- a/tests/test_output_dir.py +++ b/tests/test_output_dir.py @@ -29,7 +29,7 @@ class TestFindComfyuiOutputDir(unittest.TestCase): roots = patch.object( GalleryConfig, "allowed_gallery_parents", - return_value=[tempfile.gettempdir()], + return_value=[os.path.normcase(os.path.realpath(tempfile.gettempdir()))], ) roots.start() self.addCleanup(roots.stop) @@ -121,5 +121,22 @@ class TestFindComfyuiOutputDir(unittest.TestCase): self.assertEqual(result, str(Path(tmpdir).resolve())) +class TestOutputDirectoryFixturePortability(unittest.TestCase): + def test_aliased_temporary_parent_uses_the_real_gallery_allowlist(self): + with tempfile.TemporaryDirectory() as directory: + parent = Path(directory) + (parent / "alias").mkdir() + (parent / "actual").mkdir() + aliased = str(parent / "alias" / ".." / "actual") + with patch("tempfile.gettempdir", return_value=aliased): + case = TestFindComfyuiOutputDir( + "test_configured_directory_takes_priority" + ) + result = unittest.TestResult() + case.run(result) + self.assertEqual(result.errors, []) + self.assertEqual(result.failures, []) + + if __name__ == "__main__": unittest.main()