Repository navigation
test: replace Mock() with unbound_session in test_app_package_service - #45162
Merged
asukaminato0721 merged 2 commits intoOct 30, 2026
Merged
asukaminato0721 merged 2 commits into
asukaminato0721 merged 2 commits into
Conversation
Replace session=Mock() with the unbound_session fixture in three test methods that call collect_icon() where the session is only passed through to a mocked _upload_files() method and never touches the DB. This is part of the effort tracked in issue langgenius#44973 to migrate unit tests away from mock SQLAlchemy sessions to real SQLite-backed or unbound session fixtures.
asukaminato0721
enabled auto-merge
October 30, 2026 11:23
asukaminato0721
previously approved these changes
Oct 30, 2026
Contributor
Pyrefly Type Coverage
|
asukaminato0721
approved these changes
Oct 30, 2026
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-30 11:56:48.312243621 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-30 11:56:30.628188856 +0000
@@ -162,28 +162,6 @@
--> providers/vdb/vdb-tencent/tests/e2e_tests/conftest.py:95:33
ERROR Object of class `ModuleType` has no attribute `VectorType` [missing-attribute]
--> providers/vdb/vdb-tidb-vector/tests/unit_tests/src/dify_vdb_tidb_vector/test_tidb_vector.py:77:5
-ERROR Unpacked keyword argument `str` is not assignable to parameter `port` with type `int | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `grpc_port` with type `int` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `prefer_grpc` with type `bool` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `https` with type `bool | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `timeout` with type `int | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `force_disable_check_same_thread` with type `bool` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `grpc_options` with type `dict[str, Any] | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR Unpacked keyword argument `str` is not assignable to parameter `auth_token_provider` with type `(() -> Awaitable[str]) | (() -> str) | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_on_qdrant_vector.py:93:51
-ERROR `None` is not subscriptable [unsupported-operation]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_service.py:152:20
-ERROR `None` is not subscriptable [unsupported-operation]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_service.py:153:35
-ERROR Argument `Any | None` is not assignable to parameter `cluster_response` with type `Mapping[str, Any]` in function `TidbService.extract_qdrant_endpoint` [bad-argument-type]
- --> providers/vdb/vdb-tidb-on-qdrant/src/dify_vdb_tidb_on_qdrant/tidb_service.py:154:75
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `ConversationStatus | SQLCoreOperations[ConversationStatus]` in function `models.model.Conversation.__init__` [bad-argument-type]
--> tests/e2e_tests/containers/controllers/console/app/test_chat_conversation_status_count_api.py:75:16
ERROR Argument `Literal['app-run']` is not assignable to parameter `triggered_from` with type `SQLCoreOperations[WorkflowRunTriggeredFrom] | WorkflowRunTriggeredFrom` in function `models.workflow.WorkflowRun.__init__` [bad-argument-type]
@@ -2116,8 +2094,6 @@
--> tests/helpers/workflow/table_runner.py:389:23
ERROR `graph_runtime_state` is uninitialized [unbound-name]
--> tests/helpers/workflow/table_runner.py:390:37
-WARN `URLError` is already caught earlier in this `try` statement, so it never matches here [unreachable-except-clause]
- --> tests/pytest_dify.py:155:34
ERROR Object of class `object` has no attribute `package` [missing-attribute]
--> tests/unit_tests/commands/test_data_migration.py:218:16
ERROR Object of class `object` has no attribute `options_override` [missing-attribute]
@@ -2222,26 +2198,6 @@
--> tests/unit_tests/controllers/console/app/test_message.py:150:16
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_model_config.py:891:36
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:325:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:336:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:365:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:390:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:431:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:461:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:488:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:529:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:592:34
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:613:34
ERROR Object of class `WorkflowRun` has no attribute `retry_index` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_workflow_run.py:222:5
ERROR Missing argument `app_model` in function `handler` [missing-argument]
@@ -2300,14 +2256,8 @@
--> tests/unit_tests/controllers/console/auth/test_email_register.py:236:12
ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_email_register.py:268:5
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/datasets/rag_pipeline/test_datasource_auth.py:828:33
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
--> tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline.py:83:9
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline.py:303:25
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline.py:334:25
ERROR Unexpected keyword argument `created_at` in function `models.workflow.WorkflowNodeExecutionModel.__init__` [unexpected-keyword]
--> tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline_workflow.py:876:9
ERROR Argument `datetime | None` is not assignable to parameter `value` with type `SQLCoreOperations[datetime] | datetime` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
@@ -2398,16 +2348,14 @@
--> tests/unit_tests/controllers/console/datasets/test_external.py:86:17
ERROR Argument `UUID` is not assignable to parameter `object` with type `ExternalKnowledgeApiPayload` in function `list.append` [bad-argument-type]
--> tests/unit_tests/controllers/console/datasets/test_external.py:88:21
+ERROR Argument `UUID` is not assignable to parameter `object` with type `RequestContext` in function `list.append` [bad-argument-type]
+ --> tests/unit_tests/controllers/console/datasets/test_external.py:88:21
ERROR Generator function should return `Generator` [bad-return]
--> tests/unit_tests/controllers/console/tag/test_tags.py:66:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form._jsonify_form_definition` [bad-argument-type]
--> tests/unit_tests/controllers/console/test_human_input_form.py:94:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form.ConsoleHumanInputFormApi._ensure_console_access` [bad-argument-type]
--> tests/unit_tests/controllers/console/test_human_input_form.py:105:57
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/test_human_input_form.py:131:22
-ERROR Argument `(ParamSpec(Unknown)) -> Response | Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/console/test_human_input_form.py:152:22
ERROR Type `Response` is not iterable [not-iterable]
--> tests/unit_tests/controllers/console/test_wraps.py:306:17
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
@@ -2462,16 +2410,6 @@
--> tests/unit_tests/controllers/inner_api/plugin/test_wraps.py:423:35
ERROR Missing argument `payload` in function `protected_view` [missing-argument]
--> tests/unit_tests/controllers/inner_api/plugin/test_wraps.py:429:36
-ERROR Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/inner_api/test_runtime_credentials.py:77:32
-ERROR Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/inner_api/test_runtime_credentials.py:107:32
-ERROR Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/inner_api/test_runtime_credentials.py:154:32
-ERROR Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/inner_api/test_runtime_credentials.py:202:32
-ERROR Argument `(ParamSpec(Unknown)) -> Unknown` is not assignable to parameter `func` with type `(...) -> Any` in function `inspect.unwrap` [bad-argument-type]
- --> tests/unit_tests/controllers/inner_api/test_runtime_credentials.py:216:32
ERROR Attribute `payload` of class `Namespace` is a read-only property and cannot be set [read-only]
--> tests/unit_tests/controllers/mcp/test_mcp.py:32:5
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
@@ -2970,8 +2908,6 @@
--> tests/unit_tests/core/agent/test_fc_agent_runner.py:238:9
ERROR Argument `None` is not assignable to parameter `query` with type `str` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner._organize_user_query` [bad-argument-type]
--> tests/unit_tests/core/agent/test_fc_agent_runner.py:339:46
-ERROR `list[str]` is not assignable to attribute `files` with type `Sequence[File] | list[File]` [bad-assignment]
- --> tests/unit_tests/core/agent/test_fc_agent_runner.py:351:24
ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
--> tests/unit_tests/core/agent/test_fc_agent_runner.py:407:58
ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
@@ -3116,6 +3052,10 @@
--> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1450:33
ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
--> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1453:16
+ERROR Object of class `NoneType` has no attribute `app_id` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1457:16
+ERROR Object of class `NoneType` has no attribute `user_id` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1458:16
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
--> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1498:33
ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
@@ -3686,6 +3626,8 @@
--> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:925:59
ERROR Argument `TestWorkflowAppRunnerCoreCases.TestWorkflowBasedAppRunner.test_handle_start_node_result_events_project_outputs._QueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
--> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1004:59
+ERROR Object of class `object` has no attribute `outputs` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1027:20
ERROR Argument `_DummyQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.__init__` [bad-argument-type]
--> tests/unit_tests/core/app/apps/test_workflow_app_runner.py:1056:55
ERROR Argument `_DummyWorkflowEntry` is not assignable to parameter `workflow_entry` with type `WorkflowEntry` in function `core.app.apps.workflow_app_runner.WorkflowBasedAppRunner.handle_event` [bad-argument-type]
@@ -3722,6 +3664,10 @@
--> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:1414:37
ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
--> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:1419:20
+ERROR Object of class `NoneType` has no attribute `app_id` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:1423:20
+ERROR Object of class `NoneType` has no attribute `user_id` [missing-attribute]
+ --> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:1424:20
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.workflow.app_generator.WorkflowAppGenerator.resume` [bad-argument-type]
--> tests/unit_tests/core/app/apps/workflow/test_app_generator.py:1465:37
ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
@@ -4489,45 +4435,37 @@
WARN Call to deprecated overload `contextlib.contextmanager` [deprecated]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:874:1
ERROR Argument `Literal[core.entities.provider_entities.ProviderQuotaType.TRIAL]` is not assignable to parameter `quota_type` with type `models.enums.ProviderQuotaType | SQLCoreOperations[models.enums.ProviderQuotaType | None] | None` in function `models.provider.Provider.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:120:20
+ --> tests/unit_tests/core/test_provider_manager.py:119:20
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:178:20
-ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:191:24
+ --> tests/unit_tests/core/test_provider_manager.py:177:20
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:200:24
-ERROR Argument `list[ProviderModelSetting]` is not assignable to parameter `provider_model_settings` with type `list[_ProviderModelSettingCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:221:37
-ERROR Argument `list[LoadBalancingModelConfig]` is not assignable to parameter `load_balancing_model_configs` with type `list[_LoadBalancingModelConfigCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:222:42
-ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:265:20
+ --> tests/unit_tests/core/test_provider_manager.py:190:24
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:274:24
+ --> tests/unit_tests/core/test_provider_manager.py:199:24
ERROR Argument `list[ProviderModelSetting]` is not assignable to parameter `provider_model_settings` with type `list[_ProviderModelSettingCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:288:67
+ --> tests/unit_tests/core/test_provider_manager.py:220:37
ERROR Argument `list[LoadBalancingModelConfig]` is not assignable to parameter `load_balancing_model_configs` with type `list[_LoadBalancingModelConfigCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:288:77
+ --> tests/unit_tests/core/test_provider_manager.py:221:42
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:478:20
+ --> tests/unit_tests/core/test_provider_manager.py:416:20
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:489:24
+ --> tests/unit_tests/core/test_provider_manager.py:427:24
ERROR Argument `list[ProviderModelSetting]` is not assignable to parameter `provider_model_settings` with type `list[_ProviderModelSettingCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:509:37
+ --> tests/unit_tests/core/test_provider_manager.py:447:37
ERROR Argument `list[LoadBalancingModelConfig]` is not assignable to parameter `load_balancing_model_configs` with type `list[_LoadBalancingModelConfigCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:510:42
+ --> tests/unit_tests/core/test_provider_manager.py:448:42
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.ProviderModelSetting.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:528:20
+ --> tests/unit_tests/core/test_provider_manager.py:466:20
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:539:24
+ --> tests/unit_tests/core/test_provider_manager.py:477:24
ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:548:24
+ --> tests/unit_tests/core/test_provider_manager.py:486:24
ERROR Argument `list[ProviderModelSetting]` is not assignable to parameter `provider_model_settings` with type `list[_ProviderModelSettingCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:569:37
+ --> tests/unit_tests/core/test_provider_manager.py:507:37
ERROR Argument `list[LoadBalancingModelConfig]` is not assignable to parameter `load_balancing_model_configs` with type `list[_LoadBalancingModelConfigCacheEntry] | None` in function `core.provider_manager.ProviderManager._to_model_settings` [bad-argument-type]
- --> tests/unit_tests/core/test_provider_manager.py:570:42
+ --> tests/unit_tests/core/test_provider_manager.py:508:42
WARN Identity comparison `False is True` is always False [unnecessary-comparison]
- --> tests/unit_tests/core/test_provider_manager.py:1309:30
+ --> tests/unit_tests/core/test_provider_manager.py:1247:30
ERROR Class member `DummyTool.get_runtime_parameters` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/core/tools/__base/test_tool.py:71:9
ERROR Object of type `ToolInvokeMessage.BlobChunkMessage | ToolInvokeMessage.BlobMessage | ToolInvokeMessage.FileMessage | ToolInvokeMessage.JsonMessage | ToolInvokeMessage.LogMessage | ToolInvokeMessage.RetrieverResourceMessage | ToolInvokeMessage.TextMessage | ToolInvokeMessage.VariableMessage | None` has no attribute `text` [missing-attribute]
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45162 +/- ##
===========================================
+ Coverage 68.59% 89.82% +21.22%
===========================================
Files 6088 6244 +156
Lines 368824 397314 +28490
Branches 78076 80019 +1943
===========================================
+ Hits 253002 356879 +103877
+ Misses 113017 34136 -78881
- Partials 2805 6299 +3494
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace
session=Mock()with theunbound_sessionfixture in three test methods intest_app_package_service.pythat callcollect_icon().The mocked session is only passed through to a mocked
_upload_files()method and never touches the DB, sounbound_sessionis the appropriate fixture to use.This is part of the effort tracked in issue #44973 to migrate unit tests away from mock SQLAlchemy sessions to real SQLite-backed or unbound session fixtures.
Changes
test_app_package_restores_independent_site_image_icon: Addedunbound_session: Sessionparameter, replaced 2session=Mock()callstest_icon_export_rejects_unavailable_tenant_upload: Addedunbound_session: Sessionparameter, replacedsession=Mock()calltest_roster_export_embeds_agent_icon: Addedunbound_session: Sessionparameter, replacedsession=Mock()callFixes #44973 (partial - one file)