refactor test markers for clarity
This commit is contained in:
@@ -5,7 +5,7 @@ from app.news import NewsApiWrapper
|
|||||||
|
|
||||||
@pytest.mark.news
|
@pytest.mark.news
|
||||||
@pytest.mark.api
|
@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:
|
class TestNewsAPI:
|
||||||
|
|
||||||
def test_news_api_initialization(self):
|
def test_news_api_initialization(self):
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
from praw import Reddit
|
from praw import Reddit
|
||||||
from app.social.reddit import MAX_COMMENTS, RedditWrapper
|
from app.social.reddit import MAX_COMMENTS, RedditWrapper
|
||||||
|
|
||||||
@pytest.mark.social
|
@pytest.mark.social
|
||||||
@pytest.mark.api
|
@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:
|
class TestRedditWrapper:
|
||||||
def test_initialization(self):
|
def test_initialization(self):
|
||||||
wrapper = RedditWrapper()
|
wrapper = RedditWrapper()
|
||||||
|
|||||||
@@ -14,17 +14,20 @@ def pytest_configure(config:pytest.Config):
|
|||||||
|
|
||||||
markers = [
|
markers = [
|
||||||
("slow", "marks tests as slow (deselect with '-m \"not slow\"')"),
|
("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"),
|
("api", "marks tests that require API access"),
|
||||||
("market", "marks tests that use market data"),
|
("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"),
|
("gemini", "marks tests that use Gemini model"),
|
||||||
("ollama_gpt", "marks tests that use Ollama GPT model"),
|
("ollama_gpt", "marks tests that use Ollama GPT model"),
|
||||||
("ollama_qwen", "marks tests that use Ollama Qwen 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:
|
for marker in markers:
|
||||||
line = f"{marker[0]}: {marker[1]}"
|
line = f"{marker[0]}: {marker[1]}"
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import pytest
|
|||||||
from app.agents.market_agent import MarketToolkit
|
from app.agents.market_agent import MarketToolkit
|
||||||
from app.markets import MarketAPIsTool
|
from app.markets import MarketAPIsTool
|
||||||
|
|
||||||
@pytest.mark.limited # usa molte api calls e non voglio esaurire le chiavi api
|
|
||||||
@pytest.mark.tools
|
@pytest.mark.tools
|
||||||
|
@pytest.mark.market
|
||||||
@pytest.mark.api
|
@pytest.mark.api
|
||||||
class TestMarketAPIsTool:
|
class TestMarketAPIsTool:
|
||||||
def test_wrapper_initialization(self):
|
def test_wrapper_initialization(self):
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import pytest
|
|||||||
from app.news import NewsAPIsTool
|
from app.news import NewsAPIsTool
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.limited
|
|
||||||
@pytest.mark.tools
|
@pytest.mark.tools
|
||||||
@pytest.mark.news
|
@pytest.mark.news
|
||||||
@pytest.mark.api
|
@pytest.mark.api
|
||||||
|
|||||||
Reference in New Issue
Block a user