""" Pytest configuration and fixtures for VAMGUARD_TITAN tests """ import pytest import os import tempfile import shutil from pathlib import Path @pytest.fixture def temp_dir(): """Create a temporary directory for testing""" temp_path = tempfile.mkdtemp() yield Path(temp_path) shutil.rmtree(temp_path, ignore_errors=True) @pytest.fixture def mock_env_vars(monkeypatch): """Mock environment variables for testing""" test_env = { "HF_TOKEN": "test_token_123", "GITHUB_TOKEN": "github_test_token", "GOOGLE_API_KEY": "google_test_key", "SPACE_ID": "test_space_id" } for key, value in test_env.items(): monkeypatch.setenv(key, value) return test_env @pytest.fixture def sample_python_file(temp_dir): """Create a sample Python file for testing""" file_path = temp_dir / "sample.py" content = '''#!/usr/bin/env python3 """Sample Python file""" import os from pathlib import Path def hello(): return "Hello, World!" if __name__ == "__main__": print(hello()) ''' file_path.write_text(content) return file_path @pytest.fixture def sample_directory_structure(temp_dir): """Create a sample directory structure for testing""" # Create directories (temp_dir / "dir1").mkdir() (temp_dir / "dir2").mkdir() (temp_dir / "dir1" / "subdir").mkdir() # Create files (temp_dir / "file1.txt").write_text("Content 1") (temp_dir / "file2.txt").write_text("Content 2") (temp_dir / "dir1" / "file3.txt").write_text("Content 3") (temp_dir / "dir1" / "subdir" / "file4.txt").write_text("Content 4") (temp_dir / "dir2" / "file5.txt").write_text("Content 5") return temp_dir