Refactor pytest configuration:
- streamline marker addition - remove unused OLLAMA_MODELS_PATH (OLLAMA_HOST should be enough even for Docker)
This commit is contained in:
@@ -5,12 +5,6 @@
|
||||
# Alcune API sono a pagamento, altre hanno un piano gratuito con limiti di utilizzo
|
||||
# Vedi https://docs.agno.com/examples/models per vedere tutti i modelli supportati
|
||||
GOOGLE_API_KEY=
|
||||
# Dipende dal sistema operativo
|
||||
# windows: C:\Users\<user>\.ollama
|
||||
# mac: /Users/<user>/.ollama
|
||||
# linux: /home/<user>/.ollama
|
||||
# wsl: /usr/share/ollama/.ollama
|
||||
OLLAMA_MODELS_PATH=
|
||||
|
||||
###############################################################################
|
||||
# Configurazioni per gli agenti di mercato
|
||||
|
||||
27
README.md
27
README.md
@@ -90,16 +90,19 @@ Il file `.env` verrà automaticamente caricato nel container grazie alla configu
|
||||
***L'applicazione è attualmente in fase di sviluppo.***
|
||||
|
||||
Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per interagire con l'agente principale. Gli agenti secondari si trovano nella cartella `src/app/agents` e sono:
|
||||
- **Market Agent**: ~~Agente unificato che supporta multiple fonti di dati (Coinbase + CryptoCompare) con auto-configurazione~~ (non proprio un agente per ora)
|
||||
- **News Agent**: Recupera le notizie finanziarie più recenti utilizzando. ***MOCK***
|
||||
- **Social Agent**: Analizza i sentimenti sui social media utilizzando. ***MOCK***
|
||||
- **Market Agent**: Agente unificato che supporta multiple fonti di dati (Coinbase + CryptoCompare) con auto-configurazione
|
||||
- **News Agent**: Recupera le notizie finanziarie più recenti utilizzando.
|
||||
- **Social Agent**: Analizza i sentimenti sui social media utilizzando.
|
||||
- **Predictor Agent**: Utilizza i dati raccolti dagli altri agenti per fare previsioni.
|
||||
|
||||
## Ultimo Aggiornamento
|
||||
### Market Agent Features:
|
||||
- **Auto-configurazione**: Configura automaticamente i provider disponibili basandosi sulle env vars
|
||||
- **Multiple provider**: Supporta sia Coinbase (trading) che CryptoCompare (market data)
|
||||
- **Interfaccia unificata**: Un'unica API per accedere a tutti i provider
|
||||
|
||||
### Cose non funzionanti
|
||||
- **Market Agent**: Non è un vero agente dato che non usa LLM per ragionare ma prende solo i dati
|
||||
- **market_aggregator.py**: Non è usato per ora
|
||||
- **News Agent**: Non funziona lo scraping online, per ora usa dati mock
|
||||
- **Social Agent**: Non funziona lo scraping online, per ora usa dati mock
|
||||
- **Demos**: Le demos nella cartella [demos](demos) non sono aggiornate e non funzionano per ora
|
||||
|
||||
### ToDo
|
||||
- [X] Per lo scraping online bisogna iscriversi e recuperare le chiavi API
|
||||
@@ -114,4 +117,12 @@ Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per in
|
||||
Per eseguire i test, assicurati di aver configurato correttamente le variabili d'ambiente nel file `.env` come descritto sopra. Poi esegui il comando:
|
||||
```sh
|
||||
uv run pytest -v
|
||||
```
|
||||
|
||||
# Oppure per test specifici
|
||||
uv run pytest -v tests/agents/test_market.py
|
||||
uv run pytest -v tests/agents/test_predictor.py
|
||||
|
||||
# Oppure usando i markers
|
||||
uv run pytest -v -m api
|
||||
uv run pytest -v -m "api and not slow"
|
||||
```
|
||||
|
||||
@@ -15,46 +15,38 @@ 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"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "gemini: marks tests that use Gemini model"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "ollama_gpt: marks tests that use Ollama GPT model"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "ollama_qwen: marks tests that use Ollama Qwen model"
|
||||
)
|
||||
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"),
|
||||
]
|
||||
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"""
|
||||
# Aggiungi marker 'api' a tutti i test che richiedono API
|
||||
"""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,
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if "gemini" in item.name.lower():
|
||||
item.add_marker(pytest.mark.gemini)
|
||||
if "ollama_gpt" in item.name.lower():
|
||||
item.add_marker(pytest.mark.ollama_gpt)
|
||||
if "ollama_qwen" in item.name.lower():
|
||||
item.add_marker(pytest.mark.ollama_qwen)
|
||||
name = item.name.lower()
|
||||
for key, marker in markers_to_add.items():
|
||||
if key in name:
|
||||
item.add_marker(marker)
|
||||
|
||||
Reference in New Issue
Block a user