"""Test for virtual environment and gitignore setup (T02).""" import os import pytest @pytest.mark.unit class TestVirtualEnvironmentSetup: """Test virtual environment and gitignore configuration.""" def test_gitignore_exists(self): """Verify .gitignore file exists.""" gitignore_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/.gitignore" assert os.path.isfile(gitignore_path), f"File {gitignore_path} does not exist" def test_gitignore_contains_venv(self): """Verify .gitignore excludes virtual environments.""" gitignore_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/.gitignore" with open(gitignore_path, 'r') as f: content = f.read() assert '.venv/' in content or 'venv/' in content or 'ENV/' in content, \ ".gitignore should exclude virtual environment directories" def test_gitignore_contains_pycache(self): """Verify .gitignore excludes __pycache__.""" gitignore_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/.gitignore" with open(gitignore_path, 'r') as f: content = f.read() assert '__pycache__/' in content, ".gitignore should exclude __pycache__" def test_gitignore_contains_env(self): """Verify .gitignore excludes .env files.""" gitignore_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/.gitignore" with open(gitignore_path, 'r') as f: content = f.read() assert '.env' in content, ".gitignore should exclude .env files" def test_gitignore_contains_db_files(self): """Verify .gitignore excludes database files.""" gitignore_path = "/home/google/Sources/LucaSacchiNet/openrouter-watcher/.gitignore" with open(gitignore_path, 'r') as f: content = f.read() assert '*.db' in content or '*.sqlite' in content or '*.sqlite3' in content, \ ".gitignore should exclude database files" def test_python_version_is_311_or_higher(self): """Verify Python version is 3.11 or higher.""" import sys version_info = sys.version_info assert version_info.major == 3 and version_info.minor >= 11, \ f"Python version should be 3.11+, found {version_info.major}.{version_info.minor}"