diff --git a/pyproject.toml b/pyproject.toml index 356fb8e4..09272db3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ classifiers = [ dynamic = ["version"] dependencies = [ - "pyautogen[anthropic,together]==0.2.34", + "pyautogen[anthropic,together]==0.2.35", "faststream[nats]>=0.5.10,<0.6", "typing-extensions>=4.8.0,<5", "pydantic>=2.3,<3", @@ -67,10 +67,10 @@ server = [ # dev dependencies devdocs = [ - "mkdocs-material==9.5.29", + "mkdocs-material==9.5.32", "mkdocs-static-i18n==1.2.3", "mdx-include==1.4.2", - "mkdocstrings[python]==0.25.1", + "mkdocstrings[python]==0.25.2", "mkdocs-literate-nav==0.6.1", "mkdocs-git-revision-date-localized-plugin==1.2.6", "mike==2.1.2", # versioning @@ -89,7 +89,7 @@ lint = [ "types-Pygments", "types-docutils", "mypy==1.11.1", - "ruff==0.5.2", + "ruff==0.6.1", "pyupgrade-directories==0.3.0", "bandit==1.7.9", "semgrep==1.85.0", @@ -98,7 +98,7 @@ lint = [ test-core = [ "coverage[toml]==7.6.1", - "pytest==8.2.2", + "pytest==8.3.2", "pytest-asyncio==0.23.8", "dirty-equals==0.7.1.post0", "pytest-rerunfailures==14.0", diff --git a/tests/app/test_model_routes.py b/tests/app/test_model_routes.py index 894e10db..db59017a 100644 --- a/tests/app/test_model_routes.py +++ b/tests/app/test_model_routes.py @@ -57,7 +57,7 @@ def __init__(self, id: str, choices: List[Choice]): self.choices = choices -@pytest.mark.asyncio() +@pytest.mark.asyncio @pytest.mark.parametrize( "api_key,expected", # noqa: PT006 [("whatever", "wha*ever"), ("some_other_key", "som*******_key")], @@ -66,9 +66,9 @@ async def test_mask(api_key: str, expected: str) -> None: assert await mask(api_key) == expected -@pytest.mark.db() +@pytest.mark.db class TestModelRoutes: - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_get_all_models( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -105,7 +105,7 @@ async def test_get_all_models( for key in expected[i]: assert actual[i][key] == expected[i][key] - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_setup_user(self) -> None: random_id = random.randint(1, 1_000_000) user_uuid = await DefaultDB.frontend()._create_user( @@ -159,7 +159,7 @@ async def test_setup_user(self) -> None: actual = response.json() assert actual == expected_setup_again - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_add_model(self, user_uuid: str) -> None: model_uuid = str(uuid.uuid4()) azure_oai_api_key = AzureOAIAPIKey(api_key="whatever", name="who cares?") @@ -176,7 +176,7 @@ async def test_add_model(self, user_uuid: str) -> None: actual = response.json() assert actual == expected - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_add_model_deployment(self, user_uuid: str) -> None: team_uuid = str(uuid.uuid4()) deployment_uuid = str(uuid.uuid4()) @@ -250,7 +250,7 @@ async def test_add_model_deployment(self, user_uuid: str) -> None: actual = response.json() assert actual == expected - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_add_model_deployment_with_long_name(self, user_uuid: str) -> None: team_uuid = str(uuid.uuid4()) deployment_uuid = str(uuid.uuid4()) @@ -283,7 +283,7 @@ async def test_add_model_deployment_with_long_name(self, user_uuid: str) -> None assert response.status_code != 200 - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_background_task_not_called_on_error(self, user_uuid: str) -> None: team_uuid = str(uuid.uuid4()) deployment_uuid = str(uuid.uuid4()) @@ -328,7 +328,7 @@ async def test_background_task_not_called_on_error(self, user_uuid: str) -> None mock_task.assert_not_called() assert response.status_code != 200 - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_update_model( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -357,7 +357,7 @@ async def test_update_model( actual = response.json() assert actual == expected - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_update_model_deployment(self, user_uuid: str) -> None: team_uuid = str(uuid.uuid4()) deployment_uuid = str(uuid.uuid4()) @@ -459,7 +459,7 @@ async def test_update_model_deployment(self, user_uuid: str) -> None: actual = response.json() assert actual == expected - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_delete_model( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -485,8 +485,8 @@ async def test_delete_model( actual = response.json() assert actual == expected - @pytest.mark.llm() - @pytest.mark.asyncio() + @pytest.mark.llm + @pytest.mark.asyncio async def test_chat_with_no_function_calling( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -530,8 +530,8 @@ async def test_chat_with_no_function_calling( # Assert the mock was called with the correct arguments mock_create.assert_called_once() - @pytest.mark.llm() - @pytest.mark.asyncio() + @pytest.mark.llm + @pytest.mark.asyncio async def test_chat_error( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -571,8 +571,8 @@ async def test_chat_error( # Assert the mock was called with the correct arguments mock_create.assert_called_once() - @pytest.mark.llm() - @pytest.mark.asyncio() + @pytest.mark.llm + @pytest.mark.asyncio async def test_chat_with_function_calling( self, user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -626,7 +626,7 @@ async def test_chat_with_function_calling( # Assert the mock was called with the correct arguments mock_create.assert_called_once() - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_ping(self) -> None: deployment_uuid = str(uuid.uuid4()) response = client.get(f"/deployment/{deployment_uuid}/ping") diff --git a/tests/app/test_openai_extensively.py b/tests/app/test_openai_extensively.py index 77d347a4..dd925bf0 100644 --- a/tests/app/test_openai_extensively.py +++ b/tests/app/test_openai_extensively.py @@ -15,7 +15,7 @@ class TestValidateOpenAIKey: - @pytest.fixture() + @pytest.fixture def model_dict(self) -> Dict[str, Any]: model = OpenAIAPIKey( api_key="sk-sUeBP9asw6GiYHXqtg70T3BlbkFJJuLwJFco90bOpU0Ntest", # pragma: allowlist secret @@ -50,8 +50,8 @@ def test_validate_incorrect_api_key(self, model_dict: Dict[str, Any]) -> None: } assert msg_dict == expected - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_validate_secret_model( self, model_dict: Dict[str, Any], @@ -80,7 +80,7 @@ async def test_validate_secret_model( # we will do this for OpenAI only, the rest should be the same class TestValidateOpenAI: - @pytest.fixture() + @pytest.fixture def model_dict(self) -> Dict[str, Any]: key_uuid = uuid.uuid4() OpenAIAPIKeyRef = OpenAIAPIKey.get_reference_model() # noqa: N806 @@ -181,8 +181,8 @@ def test_get_schemas() -> None: class TestToolbox: - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_add_toolbox(self, user_uuid: str, fastapi_openapi_url: str) -> None: openapi_auth = OpenAPIAuth( name="openapi_auth_secret", @@ -225,7 +225,7 @@ async def test_add_toolbox(self, user_uuid: str, fastapi_openapi_url: str) -> No actual = response.json() assert actual == expected - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_validate_toolbox(self, fastapi_openapi_url: str) -> None: openapi_auth = OpenAPIAuth( name="openapi_auth_secret", @@ -244,7 +244,7 @@ async def test_validate_toolbox(self, fastapi_openapi_url: str) -> None: await validate_toolbox(toolbox) - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_validate_toolbox_route(self, fastapi_openapi_url: str) -> None: openapi_auth = OpenAPIAuth( name="openapi_auth_secret", @@ -269,7 +269,7 @@ async def test_validate_toolbox_route(self, fastapi_openapi_url: str) -> None: ) assert response.status_code == 200 - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_validate_toolbox_with_404_url(self) -> None: invalid_url = "http://i.dont.exist.airt.ai/openapi.json" @@ -294,7 +294,7 @@ async def test_validate_toolbox_with_404_url(self) -> None: assert e.value.status_code == 422 assert e.value.detail == "OpenAPI URL is invalid" - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_validate_toolbox_with_invalid_openapi_spec(self) -> None: invalid_url = "http://echo.jsontest.com/key/value/one/two" @@ -319,7 +319,7 @@ async def test_validate_toolbox_with_invalid_openapi_spec(self) -> None: assert e.value.status_code == 422 assert e.value.detail == "OpenAPI URL does not contain a valid OpenAPI spec" - @pytest.mark.asyncio() + @pytest.mark.asyncio async def test_validate_toolbox_with_yaml_openapi_spec(self) -> None: invalid_url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml" diff --git a/tests/auth_token/test_auth_token.py b/tests/auth_token/test_auth_token.py index 9fe3f6f6..212baf38 100644 --- a/tests/auth_token/test_auth_token.py +++ b/tests/auth_token/test_auth_token.py @@ -47,7 +47,7 @@ def test_verify_auth_token() -> None: assert not verify_auth_token("wrong_token", "wrong_hash") -@pytest.mark.asyncio() +@pytest.mark.asyncio async def test_parse_expiry() -> None: expiry = await parse_expiry("1d") assert expiry is not None @@ -55,7 +55,7 @@ async def test_parse_expiry() -> None: assert expiry > datetime.utcnow() -@pytest.mark.asyncio() +@pytest.mark.asyncio @pytest.mark.parametrize( "expiry_str, expected", # noqa: PT006 [ @@ -75,8 +75,8 @@ async def test_parse_expiry_with_invalid_expiry(expiry_str: str, expected: str) assert e.value.detail == expected -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_create_deployment_token( user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -99,8 +99,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI assert len(token.auth_token) == 32, token.auth_token -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_create_deployment_token_with_wrong_user_uuid( user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -125,8 +125,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI assert e.value.detail == "User does not have access to this deployment" -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_create_deployment_auth_token_route( user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -153,8 +153,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI assert response.json()["auth_token"] is not None -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_get_all_deployment_auth_tokens( user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -192,8 +192,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI assert response_json[0]["expiry"] == "99d" -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_delete_deployment_auth_token( user_uuid: str, monkeypatch: pytest.MonkeyPatch ) -> None: diff --git a/tests/conftest.py b/tests/conftest.py index fba08a02..6e77d631 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -122,19 +122,19 @@ def get_default_model_name(model_env_name: str) -> str: @tag("llm_config") -@pytest.fixture() +@pytest.fixture def azure_gpt35_turbo_16k_llm_config() -> Dict[str, Any]: return azure_model_llm_config("AZURE_GPT35_MODEL") @tag("llm_config") -@pytest.fixture() +@pytest.fixture def azure_gpt4_llm_config() -> Dict[str, Any]: return azure_model_llm_config("AZURE_GPT4_MODEL") @tag("llm_config") -@pytest.fixture() +@pytest.fixture def azure_gpt4o_llm_config() -> Dict[str, Any]: return azure_model_llm_config("AZURE_GPT4o_MODEL") @@ -159,7 +159,7 @@ def openai_llm_config(model: str) -> Dict[str, Any]: @tag("llm_config") -@pytest.fixture() +@pytest.fixture def openai_gpt35_turbo_16k_llm_config() -> Dict[str, Any]: return openai_llm_config("gpt-3.5-turbo") diff --git a/tests/db/test_inmemory.py b/tests/db/test_inmemory.py index 6c22d194..d0c9f615 100644 --- a/tests/db/test_inmemory.py +++ b/tests/db/test_inmemory.py @@ -13,7 +13,7 @@ from fastagency.models.llms.azure import AzureOAIAPIKey -@pytest.mark.asyncio() +@pytest.mark.asyncio class TestInMemoryFrontendDB: async def test_set(self) -> None: frontend_db = InMemoryFrontendDB() @@ -53,8 +53,8 @@ async def test_user_exception(self) -> None: assert f"user_uuid {user_uuid} not found" == str(e.value) -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio class TestInMemoryBackendDB: async def test_model_CRUD(self) -> None: # noqa: N802 # Setup diff --git a/tests/db/test_prisma.py b/tests/db/test_prisma.py index 9b52fb30..1cc22abb 100644 --- a/tests/db/test_prisma.py +++ b/tests/db/test_prisma.py @@ -13,8 +13,8 @@ from fastagency.models.llms.azure import AzureOAIAPIKey -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio class TestPrismaFrontendDB: async def test_set(self) -> None: frontend_db = PrismaFrontendDB() @@ -54,8 +54,8 @@ async def test_user_exception(self) -> None: assert f"user_uuid {user_uuid} not found" == str(e.value) -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio class TestPrismaBackendDB: async def test_model_CRUD(self) -> None: # noqa: N802 # Setup diff --git a/tests/faststream_app/test_faststream_app.py b/tests/faststream_app/test_faststream_app.py index afb25c7f..84eb8fa6 100644 --- a/tests/faststream_app/test_faststream_app.py +++ b/tests/faststream_app/test_faststream_app.py @@ -8,8 +8,8 @@ from fastagency.faststream_app import broker, register_handler, stream -@pytest.mark.nats() -@pytest.mark.asyncio() +@pytest.mark.nats +@pytest.mark.asyncio async def test_register_handler() -> None: client_id = random.randint(1, 1000) async with TestNatsBroker(broker, with_real=True) as br: @@ -25,8 +25,8 @@ async def test_register_handler() -> None: # Later I will send a message to "ping.*" and will await for "pong.*" message -@pytest.mark.nats() -@pytest.mark.asyncio() +@pytest.mark.nats +@pytest.mark.asyncio async def test_ping_handler() -> None: client_id = random.randint(1, 1000) @@ -59,8 +59,8 @@ async def pong_handler(msg: str) -> None: assert "process_id" in result -@pytest.mark.nats() -@pytest.mark.asyncio() +@pytest.mark.nats +@pytest.mark.asyncio async def test_ping_handler_with_wrong_message() -> None: client_id = random.randint(1, 1000) diff --git a/tests/models/agents/test_assistant.py b/tests/models/agents/test_assistant.py index e588d47d..8425c444 100644 --- a/tests/models/agents/test_assistant.py +++ b/tests/models/agents/test_assistant.py @@ -12,9 +12,9 @@ class TestAssistantAgent: - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("assistant_ref", get_by_tag("assistant")) async def test_assistant_construction( self, @@ -222,8 +222,8 @@ def test_assistant_model_schema(self) -> None: # print(f"{schema=}") assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @parametrize_fixtures("assistant_ref", get_by_tag("assistant", "weather")) async def test_assistant_create_autogen( self, @@ -243,9 +243,9 @@ def is_termination_msg(msg: Dict[str, Any]) -> bool: assert len(ag_toolkits) == 1 assert ag_assistant._is_termination_msg == is_termination_msg - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("assistant_ref", get_by_tag("assistant", "weather")) async def test_assistant_weather_end2end( self, diff --git a/tests/models/agents/test_user_proxy.py b/tests/models/agents/test_user_proxy.py index 0f9dd17d..e15cee03 100644 --- a/tests/models/agents/test_user_proxy.py +++ b/tests/models/agents/test_user_proxy.py @@ -9,8 +9,8 @@ class TestUserProxyAgent: - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db async def test_user_proxy_model_create_autogen( self, user_uuid: str, diff --git a/tests/models/agents/test_web_surfer.py b/tests/models/agents/test_web_surfer.py index f7c2744f..6fe8ed05 100644 --- a/tests/models/agents/test_web_surfer.py +++ b/tests/models/agents/test_web_surfer.py @@ -16,9 +16,9 @@ class TestWebSurferAgent: - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("websurfer_ref", get_by_tag("websurfer")) async def test_websurfer_construction( self, @@ -30,9 +30,9 @@ async def test_websurfer_construction( isinstance(websurfer, WebSurferAgent) assert websurfer.bing_api_key is not None - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("llm_ref", get_by_tag("websurfer-llm")) async def test_websurfer_llm_construction( self, @@ -285,8 +285,8 @@ def test_web_surfer_model_schema(self) -> None: # print(f"{schema=}") assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @parametrize_fixtures("websurfer_ref", get_by_tag("websurfer")) async def test_assistant_create_autogen( self, @@ -304,9 +304,9 @@ def is_termination_msg(msg: Dict[str, Any]) -> bool: assert isinstance(ag_assistant, autogen.agentchat.AssistantAgent) assert len(ag_toolkits) == 1 - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("websurfer_ref", get_by_tag("websurfer")) @pytest.mark.parametrize( "task", @@ -435,8 +435,8 @@ async def test_websurfer_end2end( # todo class TestBingAPIKey: - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db async def test_bing_api_key_model_create_autogen( self, azure_gpt35_turbo_16k_llm_config: Dict[str, Any], diff --git a/tests/models/agents/test_web_surfer_autogen.py b/tests/models/agents/test_web_surfer_autogen.py index 0ba0d374..a9935abf 100644 --- a/tests/models/agents/test_web_surfer_autogen.py +++ b/tests/models/agents/test_web_surfer_autogen.py @@ -6,8 +6,8 @@ class TestWebSurferChat: @parametrize_fixtures("websurfer_chat", get_by_tag("websurfer-chat")) - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_web_surfer_chat_constructor( self, websurfer_chat: WebSurferChat, @@ -25,9 +25,9 @@ async def test_web_surfer_chat_constructor( # "Given that weather forcast today is warm and sunny, what would be the best way to spend an evening in Zagreb according to the weather forecast?", ], ) - @pytest.mark.db() - @pytest.mark.llm() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.llm + @pytest.mark.asyncio async def test_web_surfer_chat_simple_task( self, websurfer_chat: WebSurferChat, task: str ) -> None: @@ -46,9 +46,9 @@ async def test_web_surfer_chat_simple_task( ), ], ) - @pytest.mark.db() - @pytest.mark.llm() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.llm + @pytest.mark.asyncio @pytest.mark.skip(reason="This test is not working properly in CI") async def test_web_surfer_chat_complex_task( self, websurfer_chat: WebSurferChat, task: str, follow_up: str diff --git a/tests/models/llms/test_anthropic.py b/tests/models/llms/test_anthropic.py index 1dd45c92..83afc543 100644 --- a/tests/models/llms/test_anthropic.py +++ b/tests/models/llms/test_anthropic.py @@ -17,8 +17,8 @@ def test_import(monkeypatch: pytest.MonkeyPatch) -> None: class TestAnthropic: - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_anthropic_constructor(self, anthropic_ref: ObjectReference) -> None: # create data model = await get_model_by_ref(anthropic_ref) @@ -135,9 +135,9 @@ def test_anthropic_model_schema(self) -> None: } assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.anthropic() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.anthropic async def test_anthropic_model_create_autogen( self, user_uuid: str, diff --git a/tests/models/llms/test_azure.py b/tests/models/llms/test_azure.py index a311093f..8e56fb5c 100644 --- a/tests/models/llms/test_azure.py +++ b/tests/models/llms/test_azure.py @@ -17,8 +17,8 @@ def test_import(monkeypatch: pytest.MonkeyPatch) -> None: class TestAzureOAI: - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_azure_constructor( self, azure_oai_gpt35_ref: ObjectReference ) -> None: @@ -142,8 +142,8 @@ def test_azure_model_schema(self) -> None: } assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db async def test_azure_model_create_autogen( self, user_uuid: str, diff --git a/tests/models/llms/test_end2end.py b/tests/models/llms/test_end2end.py index a85ae762..fce47c85 100644 --- a/tests/models/llms/test_end2end.py +++ b/tests/models/llms/test_end2end.py @@ -10,9 +10,9 @@ @parametrize_fixtures("llm_ref", get_by_tag("llm")) -@pytest.mark.asyncio() -@pytest.mark.db() -@pytest.mark.llm() +@pytest.mark.asyncio +@pytest.mark.db +@pytest.mark.llm @pytest.mark.skip(reason="This test is not working properly in CI") async def test_end2end_simple_chat_with_two_agents( user_uuid: str, diff --git a/tests/models/llms/test_llm_keys.py b/tests/models/llms/test_llm_keys.py index 2de34dc8..91ef1287 100644 --- a/tests/models/llms/test_llm_keys.py +++ b/tests/models/llms/test_llm_keys.py @@ -7,9 +7,9 @@ class TestLLMKeys: - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("llm_key_ref", get_by_tag("llm-key")) async def test_llm_key_constructor( self, @@ -18,9 +18,9 @@ async def test_llm_key_constructor( model = await get_model_by_ref(llm_key_ref) assert isinstance(model, Model) - @pytest.mark.asyncio() - @pytest.mark.db() - @pytest.mark.llm() + @pytest.mark.asyncio + @pytest.mark.db + @pytest.mark.llm @parametrize_fixtures("llm_key_ref", get_by_tag("llm-key")) async def test_llm_key_create_autogen( self, diff --git a/tests/models/llms/test_openai.py b/tests/models/llms/test_openai.py index 5396816d..3912e41a 100644 --- a/tests/models/llms/test_openai.py +++ b/tests/models/llms/test_openai.py @@ -38,8 +38,8 @@ def test_constructor_failure(self) -> None: class TestOpenAI: - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio @parametrize_fixtures("openai_oai_ref", get_by_tag("openai-llm")) async def test_openai_constructor(self, openai_oai_ref: ObjectReference) -> None: # create data @@ -64,7 +64,7 @@ async def test_openai_constructor(self, openai_oai_ref: ObjectReference) -> None } assert model.model_dump() == expected - @pytest.mark.openai() + @pytest.mark.openai def test_openai_model_list(self) -> None: client = openai.OpenAI() @@ -175,8 +175,8 @@ def test_openai_schema(self) -> None: # print(f"{schema=}") assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @parametrize_fixtures("openai_oai_ref", get_by_tag("openai-llm")) async def test_openai_model_create_autogen( self, diff --git a/tests/models/llms/test_together.py b/tests/models/llms/test_together.py index dc94467c..e08ab974 100644 --- a/tests/models/llms/test_together.py +++ b/tests/models/llms/test_together.py @@ -43,7 +43,7 @@ def test_constructor_failure(self) -> None: class TestTogetherAI: - @pytest.mark.togetherai() + @pytest.mark.togetherai def test_together_model_string(self) -> None: # requires that environment variables TOGETHER_API_KEY is set client = Together() @@ -57,8 +57,8 @@ def test_together_model_string(self) -> None: # print(expected_together_model_string) assert together_model_string == expected_together_model_string - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_togetherai_constructor( self, togetherai_ref: ObjectReference, @@ -171,8 +171,8 @@ def test_togetherai_schema(self) -> None: schema["properties"]["model"].pop("enum") assert schema == expected - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db async def test_togetherai_model_create_autogen( self, user_uuid: str, diff --git a/tests/models/secrets/test_fly_token.py b/tests/models/secrets/test_fly_token.py index 44bb464b..6ee50f25 100644 --- a/tests/models/secrets/test_fly_token.py +++ b/tests/models/secrets/test_fly_token.py @@ -19,8 +19,8 @@ def test_constructor_success(self) -> None: fly_token.fly_token == "*" * 64 # pragma: allowlist secret ) # pragma: allowlist secret - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @pytest.mark.parametrize("fly_token_model", [(FlyToken)]) async def test_github_token_model_create_autogen( self, diff --git a/tests/models/secrets/test_github_token.py b/tests/models/secrets/test_github_token.py index db081ccb..8ff249a3 100644 --- a/tests/models/secrets/test_github_token.py +++ b/tests/models/secrets/test_github_token.py @@ -19,8 +19,8 @@ def test_constructor_success(self) -> None: gh_token.gh_token == "*" * 64 # pragma: allowlist secret ) # pragma: allowlist secret - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @pytest.mark.parametrize("gh_token_model", [(GitHubToken)]) async def test_github_token_model_create_autogen( self, diff --git a/tests/models/teams/test_multi_agents_team.py b/tests/models/teams/test_multi_agents_team.py index 51483768..f92e7d68 100644 --- a/tests/models/teams/test_multi_agents_team.py +++ b/tests/models/teams/test_multi_agents_team.py @@ -263,8 +263,8 @@ def test_multi_agent_model_validation(self, llm_model: Model) -> None: assert validated_team == team @pytest.mark.skip(reason="Temporarily disabling multi agent team") - @pytest.mark.asyncio() - @pytest.mark.db() + @pytest.mark.asyncio + @pytest.mark.db @pytest.mark.parametrize("enable_monkeypatch", [True, False]) @pytest.mark.parametrize( "llm_model,api_key_model", # noqa: PT006 diff --git a/tests/models/teams/test_two_agents_team.py b/tests/models/teams/test_two_agents_team.py index 67b2ea1f..709fb254 100644 --- a/tests/models/teams/test_two_agents_team.py +++ b/tests/models/teams/test_two_agents_team.py @@ -185,10 +185,10 @@ def test_two_agents_team_schema(self) -> None: assert schema == expected -@pytest.mark.db() -@pytest.mark.llm() +@pytest.mark.db +@pytest.mark.llm class TestTwoAgentTeamSimpleChat: - @pytest.mark.asyncio() + @pytest.mark.asyncio @parametrize_fixtures("team_ref", get_by_tag("team", "noapi")) async def test_simple_chat( self, @@ -206,7 +206,7 @@ async def test_simple_chat( history = ag_team.initiate_chat("What is 2 + 2?") assert sum(["TERMINATE" in msg["content"] for msg in history.chat_history]) == 1 - @pytest.mark.asyncio() + @pytest.mark.asyncio @parametrize_fixtures("team_ref", get_by_tag("team", "weather")) async def test_chat_with_weatherapi( self, diff --git a/tests/models/toolboxes/test_toolbox.py b/tests/models/toolboxes/test_toolbox.py index 2954d95b..a9727764 100644 --- a/tests/models/toolboxes/test_toolbox.py +++ b/tests/models/toolboxes/test_toolbox.py @@ -17,8 +17,8 @@ class TestOpenAPIAuth: class TestToolbox: - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_toolbox_constructor( self, toolbox_ref: ObjectReference, fastapi_openapi_url: str, user_uuid: str ) -> None: @@ -30,8 +30,8 @@ async def test_toolbox_constructor( assert toolbox.name == "test_toolbox" assert str(toolbox.openapi_url) == fastapi_openapi_url - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.db + @pytest.mark.asyncio async def test_toolbox_create_autogen( self, toolbox_ref: ObjectReference, diff --git a/tests/openapi/test_end2end.py b/tests/openapi/test_end2end.py index 61162f37..3bd4af51 100644 --- a/tests/openapi/test_end2end.py +++ b/tests/openapi/test_end2end.py @@ -13,7 +13,7 @@ class TestClientEnd2End: - @pytest.fixture() + @pytest.fixture def fastapi_app(self) -> FastAPI: app = FastAPI( title="My FastAPI app", @@ -80,7 +80,7 @@ def test_openapi_app(self, fastapi_app: FastAPI) -> None: assert fastapi_app is not None assert isinstance(fastapi_app, FastAPI) - @pytest.fixture() + @pytest.fixture def openapi_schema(self, fastapi_app: FastAPI) -> Dict[str, Any]: return fastapi_app.openapi() @@ -355,7 +355,7 @@ def test_openapi_schema(self, openapi_schema: Dict[str, Any]) -> None: } assert openapi_schema == expected - @pytest.fixture() + @pytest.fixture def generated_code_path(self, openapi_schema: Dict[str, Any]) -> Iterator[Path]: with TemporaryDirectory() as temp_dir: td = Path(temp_dir) @@ -533,7 +533,7 @@ class HTTPValidationError(BaseModel): models = f.read() assert models == expected - @pytest.fixture() + @pytest.fixture def client(self, openapi_schema: Dict[str, Any]) -> Client: client = Client.create(json.dumps(openapi_schema)) return client diff --git a/tests/test_conftest.py b/tests/test_conftest.py index aa2b9093..1bd84d9c 100644 --- a/tests/test_conftest.py +++ b/tests/test_conftest.py @@ -44,8 +44,8 @@ def test_openai_gpt35_turbo_16k_llm_config( assert openai_gpt35_turbo_16k_llm_config == expected -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_azure_oai_key_ref(azure_oai_key_ref: ObjectReference) -> None: assert isinstance(azure_oai_key_ref, ObjectReference) assert azure_oai_key_ref.type == "secret" @@ -55,8 +55,8 @@ async def test_azure_oai_key_ref(azure_oai_key_ref: ObjectReference) -> None: assert azure_oai_key.name.startswith("azure_oai_key_") -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_azure_oai_gpt35_ref(azure_oai_gpt35_ref: ObjectReference) -> None: assert isinstance(azure_oai_gpt35_ref, ObjectReference) assert azure_oai_gpt35_ref.type == "llm" @@ -96,17 +96,17 @@ def test_weather_fastapi_openapi(weather_fastapi_openapi_url: str) -> None: assert resp_json["info"]["title"] == "Weather" -@pytest.mark.db() -@pytest.mark.asyncio() +@pytest.mark.db +@pytest.mark.asyncio async def test_weather_toolbox_ref(weather_toolbox_ref: ObjectReference) -> None: assert isinstance(weather_toolbox_ref, ObjectReference) -@pytest.mark.anthropic() +@pytest.mark.anthropic def test_empty_anthropic() -> None: pass -@pytest.mark.openai() +@pytest.mark.openai def test_empty_openai() -> None: pass diff --git a/tests/test_nats.py b/tests/test_nats.py index 42983654..cd785208 100644 --- a/tests/test_nats.py +++ b/tests/test_nats.py @@ -34,7 +34,7 @@ def as_dict(model: BaseModel) -> Dict[str, Any]: class TestAutogen: - @pytest.mark.azure_oai() + @pytest.mark.azure_oai def test_ioconsole( self, azure_gpt35_turbo_16k_llm_config: Dict[str, Any], @@ -88,9 +88,9 @@ def get_forecast_for_city(city: str) -> str: get_forecast_for_city_mock.assert_called_once_with("New York") assert "sunny" in last_message["content"] - @pytest.mark.azure_oai() - @pytest.mark.nats() - @pytest.mark.asyncio() + @pytest.mark.azure_oai + @pytest.mark.nats + @pytest.mark.asyncio async def test_ionats_success( # noqa: C901 self, azure_gpt35_turbo_16k_llm_config: Dict[str, Any], @@ -240,9 +240,9 @@ def initiate_chat(msg: str) -> List[Dict[str, Any]]: result = (result_set.pop()).result() assert result == {"msg": "Chat completed."} - @pytest.mark.azure_oai() - @pytest.mark.nats() - @pytest.mark.asyncio() + @pytest.mark.azure_oai + @pytest.mark.nats + @pytest.mark.asyncio async def test_ionats_error_msg( self, azure_gpt35_turbo_16k_llm_config: Dict[str, Any], @@ -318,10 +318,10 @@ async def create_team( result = (result_set.pop()).result() assert result == {"msg": "Triggering error in test"} - @pytest.mark.azure_oai() - @pytest.mark.nats() - @pytest.mark.db() - @pytest.mark.asyncio() + @pytest.mark.azure_oai + @pytest.mark.nats + @pytest.mark.db + @pytest.mark.asyncio @pytest.mark.parametrize( "llm_model,api_key_model", # noqa: PT006 [ diff --git a/tests/test_saas_app_generator.py b/tests/test_saas_app_generator.py index 41348a9d..bcdabffd 100644 --- a/tests/test_saas_app_generator.py +++ b/tests/test_saas_app_generator.py @@ -9,7 +9,7 @@ from fastagency.saas_app_generator import InvalidGHTokenError, SaasAppGenerator -@pytest.fixture() +@pytest.fixture def saas_app_generator() -> SaasAppGenerator: fly_api_token = "some-token" fastagency_deployment_uuid = "some-uuid"