Files
upo-app-agents/tests/conftest.py
Berack96 badd3e2a6c Add news API integration and related configurations
- Update .env.example to include NEWS_API_KEY configuration
- Add newsapi-python dependency in pyproject.toml
- Implement NewsAPI class for fetching news articles
- Create Article model for structured news data
- Add tests for NewsAPI functionality in test_news_api.py
- Update pytest configuration to include news marker
2025-09-29 15:15:18 +02:00

49 lines
1.6 KiB
Python

"""
Configurazione pytest per i test del progetto upo-appAI.
"""
import pytest
from dotenv import load_dotenv
# Carica le variabili d'ambiente per tutti i test
load_dotenv()
def pytest_configure(config:pytest.Config):
"""Configurazione pytest con marker personalizzati"""
markers = [
("slow", "marks tests as slow (deselect with '-m \"not slow\"')"),
("api", "marks tests that require API access"),
("coinbase", "marks tests that require Coinbase credentials"),
("cryptocompare", "marks tests that require CryptoCompare credentials"),
("gemini", "marks tests that use Gemini model"),
("ollama_gpt", "marks tests that use Ollama GPT model"),
("ollama_qwen", "marks tests that use Ollama Qwen model"),
("news", "marks tests that use news"),
]
for marker in markers:
line = f"{marker[0]}: {marker[1]}"
config.addinivalue_line("markers", line)
def pytest_collection_modifyitems(config, items):
"""Modifica automaticamente gli item di test aggiungendogli marker basati sul nome"""
markers_to_add = {
"api": pytest.mark.api,
"coinbase": pytest.mark.api,
"cryptocompare": pytest.mark.api,
"overview": pytest.mark.slow,
"analysis": pytest.mark.slow,
"gemini": pytest.mark.gemini,
"ollama_gpt": pytest.mark.ollama_gpt,
"ollama_qwen": pytest.mark.ollama_qwen,
"news": pytest.mark.news,
}
for item in items:
name = item.name.lower()
for key, marker in markers_to_add.items():
if key in name:
item.add_marker(marker)