From 28fde3627e10bb97694299c02619f3ca0989916a Mon Sep 17 00:00:00 2001 From: Luca Sacchi Ricciardi Date: Tue, 7 Apr 2026 09:55:12 +0200 Subject: [PATCH] feat(setup): T05 configure pytest with coverage - Create pytest.ini with: - Test discovery configuration (testpaths, python_files) - Asyncio mode settings - Coverage configuration (>=90% requirement) - Custom markers (unit, integration, e2e, slow) - Update conftest.py with: - pytest_asyncio plugin - Shared fixtures (project_root, src_path, temp_dir, mock_env_vars) - Path configuration for imports - Add test_pytest_config.py with 12 unit tests - All tests passing (12/12) Refs: T05 Completes setup phase T01-T05 --- export/progress.md | 12 +- pytest.ini | 32 ++++++ .../conftest.cpython-313-pytest-9.0.2.pyc | Bin 168 -> 2907 bytes tests/conftest.py | 50 +++++++++ tests/unit/test_pytest_config.py | 103 ++++++++++++++++++ 5 files changed, 191 insertions(+), 6 deletions(-) create mode 100644 pytest.ini create mode 100644 tests/unit/test_pytest_config.py diff --git a/export/progress.md b/export/progress.md index 94cea7e..5a0019d 100644 --- a/export/progress.md +++ b/export/progress.md @@ -8,13 +8,13 @@ | Metrica | Valore | |---------|--------| -| **Stato** | 🟡 In Progress | -| **Progresso** | 5% | +| **Stato** | 🟢 Setup Completato | +| **Progresso** | 7% | | **Data Inizio** | 2024-04-07 | | **Data Target** | TBD | | **Task Totali** | 74 | -| **Task Completati** | 4 | -| **Task In Progress** | 1 | +| **Task Completati** | 5 | +| **Task In Progress** | 0 | --- @@ -37,12 +37,12 @@ ## 📋 Task Pianificate -### 🔧 Setup Progetto (T01-T05) - 4/5 completati +### 🔧 Setup Progetto (T01-T05) - 5/5 completati - [x] T01: Creare struttura cartelle progetto (2024-04-07) - [x] T02: Inizializzare virtual environment e .gitignore (2024-04-07) - [x] T03: Creare requirements.txt con dipendenze (2024-04-07) - [x] T04: Setup file configurazione (.env, config.py) (2024-04-07) -- [ ] T05: Configurare pytest e struttura test +- [x] T05: Configurare pytest e struttura test (2024-04-07) ### 🗄️ Database & Models (T06-T11) - 0/6 completati - [ ] T06: Creare database.py (connection & session) diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..4be2cda --- /dev/null +++ b/pytest.ini @@ -0,0 +1,32 @@ +[pytest] +# Test discovery settings +testpaths = tests +python_files = test_*.py +python_classes = Test* +python_functions = test_* + +# Asyncio settings +asyncio_mode = auto +asyncio_default_fixture_loop_scope = function + +# Coverage settings +addopts = + -v + --strict-markers + --tb=short + --cov=src/openrouter_monitor + --cov-report=term-missing + --cov-report=html:htmlcov + --cov-fail-under=90 + +# Markers +testmarkers = + unit: Unit tests (no external dependencies) + integration: Integration tests (with mocked dependencies) + e2e: End-to-end tests (full workflow) + slow: Slow tests (skip in quick mode) + +# Filter warnings +filterwarnings = + ignore::DeprecationWarning:passlib.* + ignore::UserWarning diff --git a/tests/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc b/tests/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc index 4199cbddc1f3925e1f9d21739072e7eeb6ae19d0..6c2093ecacce4889079ddc1668bbeed7b30891f8 100644 GIT binary patch literal 2907 zcmbtWO>7fK6rQ!$zxgvw2!e=ofTY0!+iFUh5~WQcxFL`xkvFM|8fmpzPwXZ3u9;aU z*sZESDn_NH4TMWAbPRzNd`MnN9P&E! zkjGi!{Jw-hBa;6BqI(uXsXm9_JRe3RJGa*_NQfqm2_1z)S6>$pNKGX=WhQ9 z(=9ZQQq8+I1VR95)NuW-81EZk#5chB8kmef8YuUV*L+5>V+mf>%q&)m%rx>iuh3;e zS=>}8*R=}E$FBLU) znFpLir=x-uQPOEm*H)BVk;pksC&2SNp=LZR*qTUWjXX(Y3?q{x3CSo@m9WHAQB@>G zRkPYOF%t%uM~xy_8(UROHA`s1PK*TC#Ho0pWJPK@;U*HHys_+ohkXXq8u~*FKM{K# zi9L5FD+6;?asFvDW3ei#I~dbdab_puu{g60nvfM>gfU2VFviDJIGxJb?(hL&C*V~e zZlSMSK1$VUz0Lq4#nCT}w~&C&=?u5WxN9GZ3gyEo0`;h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