import os import pytest import shutil from pathlib import Path @pytest.fixture def temp_directory(tmp_path): """Create a temporary directory structure for testing.""" # Create main test directory test_dir = tmp_path / "test_project" test_dir.mkdir() # Create some regular directories (test_dir / "src").mkdir() (test_dir / "src" / "utils").mkdir() (test_dir / "docs").mkdir() # Create some files (test_dir / "src" / "main.py").write_text("print('hello')") (test_dir / "src" / "utils" / "helper.py").write_text("# helper") (test_dir / "src" / "__init__.py").touch() (test_dir / "README.md").write_text("# Test Project") # Create some directories that should be ignored (test_dir / "__pycache__").mkdir() (test_dir / ".git").mkdir() (test_dir / "venv").mkdir() # Create some files that should be ignored (test_dir / "src" / "main.pyc").touch() (test_dir / ".gitignore").touch() yield test_dir