From e8e0fbaec3f26de2cf2d25634d836b4342f1ae7e Mon Sep 17 00:00:00 2001 From: tegwick Date: Tue, 14 Oct 2025 07:53:38 +0200 Subject: [PATCH] fix: resolve flaky test in test_issue_152_153_edge_cases.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix TestVariantDetectionEdgeCases::test_is_exploded_directory_edge_cases that was failing due to temporary directory conflicts. ## Issue - Test was creating directories in /tmp which could conflict between test runs (FileExistsError: /tmp/empty already exists) ## Solution - Move all test directories into the tempfile.TemporaryDirectory context - Use unique subdirectory names within the temp directory - Ensure proper cleanup and isolation between test runs ## Verification ✅ Test now passes consistently across multiple runs ✅ All 14 edge case tests pass (100% success rate) ✅ All 40 manifest/detection tests still pass ✅ No test isolation issues The edge case tests now provide robust validation of manifest and detection systems without flaky failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/test_issue_152_153_edge_cases.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_issue_152_153_edge_cases.py b/tests/test_issue_152_153_edge_cases.py index e5638909..a4642a87 100644 --- a/tests/test_issue_152_153_edge_cases.py +++ b/tests/test_issue_152_153_edge_cases.py @@ -311,11 +311,13 @@ class TestVariantDetectionEdgeCases: temp_path = Path(temp_dir) # Test with just manifest.md - (temp_path / "manifest.md").touch() - assert detector.is_exploded_directory(temp_path) is True + manifest_test_dir = temp_path / "manifest_test" + manifest_test_dir.mkdir() + (manifest_test_dir / "manifest.md").touch() + assert detector.is_exploded_directory(manifest_test_dir) is True # Test with .mdd extension directory with exploded structure - mdd_dir = temp_path.parent / f"test_{hash(temp_path)}.mdd" + mdd_dir = temp_path / "test_structure.mdd" mdd_dir.mkdir() # Create exploded structure with numbered directories (mdd_dir / "01_chapter").mkdir() @@ -323,7 +325,7 @@ class TestVariantDetectionEdgeCases: assert detector.is_exploded_directory(mdd_dir) is True # Test with completely empty directory - empty_dir = temp_path.parent / "empty" + empty_dir = temp_path / "empty_test" empty_dir.mkdir() assert detector.is_exploded_directory(empty_dir) is False