File size: 1,708 Bytes
c87f72b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
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