feat(setup): T02 initialize virtual environment and gitignore

- Create comprehensive .gitignore with Python, venv, DB exclusions
- Add test_virtual_env_setup.py with 6 unit tests
- Verify Python 3.13.5 compatibility (>= 3.11 required)
- All tests passing (6/6)

Refs: T02
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-07 09:46:21 +02:00
parent 75f40acb17
commit 3f0f77cc23
3 changed files with 123 additions and 4 deletions

69
.gitignore vendored Normal file
View File

@@ -0,0 +1,69 @@
# ===========================================
# OpenRouter API Key Monitor - .gitignore
# ===========================================
# Virtual environments
.venv/
venv/
ENV/
env/
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Database files
*.db
*.sqlite
*.sqlite3
*.db-journal
# Environment variables
.env
.env.local
.env.*.local
!.env.example
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/
# Logs
*.log
logs/
# Data directory (for local development)
data/
# Alembic
alembic/versions/*.py
!alembic/versions/.gitkeep

View File

@@ -9,11 +9,11 @@
| Metrica | Valore | | Metrica | Valore |
|---------|--------| |---------|--------|
| **Stato** | 🟡 In Progress | | **Stato** | 🟡 In Progress |
| **Progresso** | 1% | | **Progresso** | 3% |
| **Data Inizio** | 2024-04-07 | | **Data Inizio** | 2024-04-07 |
| **Data Target** | TBD | | **Data Target** | TBD |
| **Task Totali** | 74 | | **Task Totali** | 74 |
| **Task Completati** | 1 | | **Task Completati** | 2 |
| **Task In Progress** | 1 | | **Task In Progress** | 1 |
--- ---
@@ -37,9 +37,9 @@
## 📋 Task Pianificate ## 📋 Task Pianificate
### 🔧 Setup Progetto (T01-T05) - 1/5 completati ### 🔧 Setup Progetto (T01-T05) - 2/5 completati
- [x] T01: Creare struttura cartelle progetto (2024-04-07) - [x] T01: Creare struttura cartelle progetto (2024-04-07)
- [ ] T02: Inizializzare virtual environment - [x] T02: Inizializzare virtual environment e .gitignore (2024-04-07)
- [ ] T03: Creare requirements.txt con dipendenze - [ ] T03: Creare requirements.txt con dipendenze
- [ ] T04: Setup file configurazione (.env, config.py) - [ ] T04: Setup file configurazione (.env, config.py)
- [ ] T05: Configurare pytest e struttura test - [ ] T05: Configurare pytest e struttura test

View File

@@ -0,0 +1,50 @@
"""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}"