From e948a38357f7b796a51841a069fe8c458fbdbab9 Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Thu, 22 Aug 2024 12:45:13 +0200 Subject: [PATCH] packages updated (#57) --- pyproject.toml | 10 +++--- tests/app/test_model_routes.py | 36 +++++++++---------- tests/app/test_openai_extensively.py | 22 ++++++------ tests/auth_token/test_auth_token.py | 24 ++++++------- tests/conftest.py | 8 ++--- tests/db/test_inmemory.py | 6 ++-- tests/db/test_prisma.py | 8 ++--- tests/faststream_app/test_faststream_app.py | 12 +++---- tests/models/agents/test_assistant.py | 16 ++++----- tests/models/agents/test_user_proxy.py | 4 +-- tests/models/agents/test_web_surfer.py | 26 +++++++------- .../models/agents/test_web_surfer_autogen.py | 16 ++++----- tests/models/llms/test_anthropic.py | 10 +++--- tests/models/llms/test_azure.py | 8 ++--- tests/models/llms/test_end2end.py | 6 ++-- tests/models/llms/test_llm_keys.py | 12 +++---- tests/models/llms/test_openai.py | 10 +++--- tests/models/llms/test_together.py | 10 +++--- tests/models/secrets/test_fly_token.py | 4 +-- tests/models/secrets/test_github_token.py | 4 +-- tests/models/teams/test_multi_agents_team.py | 4 +-- tests/models/teams/test_two_agents_team.py | 8 ++--- tests/models/toolboxes/test_toolbox.py | 8 ++--- tests/openapi/test_end2end.py | 8 ++--- tests/test_conftest.py | 16 ++++----- tests/test_nats.py | 22 ++++++------ tests/test_saas_app_generator.py | 2 +- 27 files changed, 160 insertions(+), 160 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 356fb8e44..09272db31 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 894e10dbf..db59017ae 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 77d347a49..dd925bf09 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 9fe3f6f6c..212baf386 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 fba08a027..6e77d631f 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 6c22d194f..d0c9f6152 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 9b52fb301..1cc22abb1 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 afb25c7f3..84eb8fa64 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 e588d47d6..8425c4442 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 0f9dd17de..e15cee030 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 f7c2744f4..6fe8ed059 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 0ba0d3746..a9935abf6 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 1dd45c925..83afc5438 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 a311093fd..8e56fb5ce 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 a85ae7622..fce47c856 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 2de34dc8d..91ef1287b 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 5396816d4..3912e41a9 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 dc94467c5..e08ab9740 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 44bb464bf..6ee50f254 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 db081ccb6..8ff249a36 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 514837680..f92e7d685 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 67b2ea1f9..709fb254e 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 2954d95bc..a9727764c 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 61162f370..3bd4af516 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 aa2b90938..1bd84d9c0 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 42983654a..cd785208a 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 41348a9d1..bcdabffdc 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"