Integrato 3 fonti ma da finire binance. Fatto una struttura con i signers per i servizi.

This commit is contained in:
Simone Garau
2025-09-23 18:04:52 +02:00
parent bc6548c6fb
commit 995048831c
25 changed files with 2577 additions and 33 deletions

58
tests/conftest.py Normal file
View File

@@ -0,0 +1,58 @@
"""
Configurazione pytest per i test del progetto upo-appAI.
"""
import pytest
import os
import sys
from pathlib import Path
# Aggiungi il path src al PYTHONPATH per tutti i test
src_path = Path(__file__).parent.parent / "src"
sys.path.insert(0, str(src_path))
# Carica le variabili d'ambiente per tutti i test
from dotenv import load_dotenv
load_dotenv()
def pytest_configure(config):
"""Configurazione pytest"""
# Aggiungi marker personalizzati
config.addinivalue_line(
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
)
config.addinivalue_line(
"markers", "api: marks tests that require API access"
)
config.addinivalue_line(
"markers", "coinbase: marks tests that require Coinbase credentials"
)
config.addinivalue_line(
"markers", "cryptocompare: marks tests that require CryptoCompare credentials"
)
def pytest_collection_modifyitems(config, items):
"""Modifica automaticamente gli item di test"""
# Aggiungi marker 'api' a tutti i test che richiedono API
for item in items:
if "api" in item.name.lower() or "coinbase" in item.name.lower() or "cryptocompare" in item.name.lower():
item.add_marker(pytest.mark.api)
# Aggiungi marker 'slow' ai test che potrebbero essere lenti
if "overview" in item.name.lower() or "analysis" in item.name.lower():
item.add_marker(pytest.mark.slow)
@pytest.fixture(scope="session")
def env_vars():
"""Fixture per accedere alle variabili d'ambiente nei test"""
return {
'coinbase_configured': all([
os.getenv('COINBASE_API_KEY'),
os.getenv('COINBASE_SECRET'),
os.getenv('COINBASE_PASSPHRASE')
]),
'cryptocompare_configured': bool(os.getenv('CRYPTOCOMPARE_API_KEY')),
}