fix: resolve flaky test in test_issue_152_153_edge_cases.py
Some checks failed
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled

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 <noreply@anthropic.com>
This commit is contained in:
2025-10-14 07:53:38 +02:00
parent ab1aff3cc8
commit e8e0fbaec3

View File

@@ -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