From 3f0f77cc237de914dba19d08173982033b2209ab Mon Sep 17 00:00:00 2001 From: Luca Sacchi Ricciardi Date: Tue, 7 Apr 2026 09:46:21 +0200 Subject: [PATCH] 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 --- .gitignore | 69 ++++++++++++++++++++++++++++ export/progress.md | 8 ++-- tests/unit/test_virtual_env_setup.py | 50 ++++++++++++++++++++ 3 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 tests/unit/test_virtual_env_setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..303b2b0 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/export/progress.md b/export/progress.md index 7c3929b..9b2721d 100644 --- a/export/progress.md +++ b/export/progress.md @@ -9,11 +9,11 @@ | Metrica | Valore | |---------|--------| | **Stato** | 🟡 In Progress | -| **Progresso** | 1% | +| **Progresso** | 3% | | **Data Inizio** | 2024-04-07 | | **Data Target** | TBD | | **Task Totali** | 74 | -| **Task Completati** | 1 | +| **Task Completati** | 2 | | **Task In Progress** | 1 | --- @@ -37,9 +37,9 @@ ## 📋 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) -- [ ] T02: Inizializzare virtual environment +- [x] T02: Inizializzare virtual environment e .gitignore (2024-04-07) - [ ] T03: Creare requirements.txt con dipendenze - [ ] T04: Setup file configurazione (.env, config.py) - [ ] T05: Configurare pytest e struttura test diff --git a/tests/unit/test_virtual_env_setup.py b/tests/unit/test_virtual_env_setup.py new file mode 100644 index 0000000..079df36 --- /dev/null +++ b/tests/unit/test_virtual_env_setup.py @@ -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}"