refactor test markers for clarity

This commit is contained in:
2025-10-01 17:01:33 +02:00
parent df59e6cea6
commit 603dc7edeb
5 changed files with 14 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ from app.news import NewsApiWrapper
@pytest.mark.news
@pytest.mark.api
@pytest.mark.skipif(not os.getenv("NEWS_API_KEY"), reason="NEWS_API_KEY not set")
@pytest.mark.skipif(not os.getenv("NEWS_API_KEY"), reason="NEWS_API_KEY not set in environment variables")
class TestNewsAPI:
def test_news_api_initialization(self):

View File

@@ -1,9 +1,11 @@
import os
import pytest
from praw import Reddit
from app.social.reddit import MAX_COMMENTS, RedditWrapper
@pytest.mark.social
@pytest.mark.api
@pytest.mark.skipif(not(os.getenv("REDDIT_CLIENT_ID")) or not(os.getenv("REDDIT_API_CLIENT_ID")) or not os.getenv("REDDIT_API_CLIENT_SECRET"), reason="REDDIT_CLIENT_ID and REDDIT_API_CLIENT_SECRET not set in environment variables")
class TestRedditWrapper:
def test_initialization(self):
wrapper = RedditWrapper()

View File

@@ -14,17 +14,20 @@ def pytest_configure(config:pytest.Config):
markers = [
("slow", "marks tests as slow (deselect with '-m \"not slow\"')"),
("limited", "marks tests that have limited execution due to API constraints"),
("api", "marks tests that require API access"),
("market", "marks tests that use market data"),
("news", "marks tests that use news"),
("social", "marks tests that use social media"),
("wrapper", "marks tests for wrapper handler"),
("tools", "marks tests for tools"),
("aggregator", "marks tests for market data aggregator"),
("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"),
("social", "marks tests that use social media"),
("limited", "marks tests that have limited execution due to API constraints"),
("wrapper", "marks tests for wrapper handler"),
("tools", "marks tests for tools"),
("aggregator", "marks tests for market data aggregator"),
]
for marker in markers:
line = f"{marker[0]}: {marker[1]}"

View File

@@ -3,8 +3,9 @@ import pytest
from app.agents.market_agent import MarketToolkit
from app.markets import MarketAPIsTool
@pytest.mark.limited # usa molte api calls e non voglio esaurire le chiavi api
@pytest.mark.tools
@pytest.mark.market
@pytest.mark.api
class TestMarketAPIsTool:
def test_wrapper_initialization(self):

View File

@@ -2,7 +2,6 @@ import pytest
from app.news import NewsAPIsTool
@pytest.mark.limited
@pytest.mark.tools
@pytest.mark.news
@pytest.mark.api