Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test: add tmp_path type (#40724)
Asuka Minato6ce09762657b
diff --git a/api/tests/unit_tests/commands/test_data_migration_commands.py b/api/tests/unit_tests/commands/test_data_migration_commands.pyindex f09668463e7..ad53964d135 100644--- a/api/tests/unit_tests/commands/test_data_migration_commands.py+++ b/api/tests/unit_tests/commands/test_data_migration_commands.py@@ -69,7 +69,7 @@ def test_export_template_command_prints_scripted_json_template():}-def test_export_template_command_writes_output_file(tmp_path):+def test_export_template_command_writes_output_file(tmp_path: Path):output_file = tmp_path / "export-template.json"result = CliRunner().invoke(export_migration_data_template, ["--output", str(output_file)])@@ -79,7 +79,7 @@ def test_export_template_command_writes_output_file(tmp_path):assert json.loads(output_file.read_text())["apps"]["all"] is True-def test_export_template_command_requires_overwrite_for_existing_output(tmp_path):+def test_export_template_command_requires_overwrite_for_existing_output(tmp_path: Path):output_file = tmp_path / "export-template.json"output_file.write_text("{}")diff --git a/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py b/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.pyindex 206b0fe79f3..b050541434c 100644--- a/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py+++ b/api/tests/unit_tests/commands/test_generate_swagger_markdown_docs.py@@ -196,7 +196,7 @@ def test_patch_union_schema_markdown_fills_converter_blank_schema_types(tmp_pathassert "| allowed_file_types | [ [FileType](#filetype) ] | | No |" in patched-def test_patch_union_schema_markdown_fills_regular_schema_union_property(tmp_path):+def test_patch_union_schema_markdown_fills_regular_schema_union_property(tmp_path: Path):module = _load_generate_swagger_markdown_docs_module()spec_path = tmp_path / "service-openapi.json"spec_path.write_text(@@ -282,7 +282,7 @@ def test_patch_union_schema_markdown_fills_array_item_union_property(tmp_path: P) in patched-def test_patch_union_schema_markdown_ignores_specs_without_schemas(tmp_path):+def test_patch_union_schema_markdown_ignores_specs_without_schemas(tmp_path: Path):module = _load_generate_swagger_markdown_docs_module()spec_path = tmp_path / "console-openapi.json"spec_path.write_text("{}", encoding="utf-8")diff --git a/api/tests/unit_tests/commands/test_generate_swagger_specs.py b/api/tests/unit_tests/commands/test_generate_swagger_specs.pyindex a326e11fb70..d3005256e68 100644--- a/api/tests/unit_tests/commands/test_generate_swagger_specs.py+++ b/api/tests/unit_tests/commands/test_generate_swagger_specs.py@@ -60,7 +60,7 @@ def _nullable_schema_ref(schema):return next(item["$ref"] for item in schema["anyOf"] if "$ref" in item)-def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path):+def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -78,7 +78,7 @@ def test_generate_specs_writes_console_web_and_service_openapi_files(tmp_path):assert "paths" in payload-def test_generate_specs_writes_openapi_with_resolvable_references_and_no_nulls(tmp_path):+def test_generate_specs_writes_openapi_with_resolvable_references_and_no_nulls(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -98,7 +98,7 @@ def test_generate_specs_writes_openapi_with_resolvable_references_and_no_nulls(tassert all(value is not None for value in _walk_values(payload))-def test_generate_specs_writes_unique_operation_ids(tmp_path):+def test_generate_specs_writes_unique_operation_ids(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -110,7 +110,7 @@ def test_generate_specs_writes_unique_operation_ids(tmp_path):assert len(operation_ids) == len(set(operation_ids))-def test_system_features_specs_exclude_backend_only_fields(tmp_path):+def test_system_features_specs_exclude_backend_only_fields(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -131,7 +131,7 @@ def test_system_features_specs_exclude_backend_only_fields(tmp_path):assert "PluginManagerModel" not in schemas-def test_generate_specs_writes_get_operations_without_request_bodies(tmp_path):+def test_generate_specs_writes_get_operations_without_request_bodies(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -142,7 +142,7 @@ def test_generate_specs_writes_get_operations_without_request_bodies(tmp_path):assert all("requestBody" not in operation for operation in _get_operations(payload))-def test_generate_specs_writes_service_api_reference_descriptions(tmp_path):+def test_generate_specs_writes_service_api_reference_descriptions(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -175,7 +175,7 @@ def test_standalone_inline_model_name_includes_list_constraints():assert module._inline_model_name(first_inline_model) != module._inline_model_name(second_inline_model)-def test_generate_specs_is_idempotent(tmp_path):+def test_generate_specs_is_idempotent(tmp_path: Path):module = _load_generate_swagger_specs_module()first_paths = module.generate_specs(tmp_path / "first")@@ -186,7 +186,7 @@ def test_generate_specs_is_idempotent(tmp_path):assert first_path.read_text(encoding="utf-8") == second_path.read_text(encoding="utf-8")-def test_generate_specs_include_agent_v2_knowledge_set_schema_and_query_enums(tmp_path):+def test_generate_specs_include_agent_v2_knowledge_set_schema_and_query_enums(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)@@ -201,7 +201,7 @@ def test_generate_specs_include_agent_v2_knowledge_set_schema_and_query_enums(tmassert schemas["AgentKnowledgeQueryMode"]["enum"] == ["generated_query", "user_query"]-def test_generate_specs_include_console_contract_shapes_for_schema_migration(tmp_path):+def test_generate_specs_include_console_contract_shapes_for_schema_migration(tmp_path: Path):module = _load_generate_swagger_specs_module()written_paths = module.generate_specs(tmp_path)diff --git a/api/tests/unit_tests/controllers/test_swagger.py b/api/tests/unit_tests/controllers/test_swagger.pyindex 9ea27878c8e..a04927ea453 100644--- a/api/tests/unit_tests/controllers/test_swagger.py+++ b/api/tests/unit_tests/controllers/test_swagger.py@@ -2,6 +2,7 @@import jsonfrom collections.abc import Iterator+from pathlib import Pathimport pytestfrom flask import Flask@@ -617,7 +618,7 @@ def test_console_member_invite_documents_bad_request_response():}-def test_console_plugin_category_list_exported_schema_uses_typed_items(tmp_path):+def test_console_plugin_category_list_exported_schema_uses_typed_items(tmp_path: Path):from dev.generate_swagger_specs import generate_specswritten_paths = generate_specs(tmp_path)@@ -658,7 +659,7 @@ def test_console_plugin_category_list_exported_schema_uses_typed_items(tmp_path)assert field in builtin_tool_schema["properties"]-def test_console_installed_plugin_ids_exported_schema_is_lightweight(tmp_path):+def test_console_installed_plugin_ids_exported_schema_is_lightweight(tmp_path: Path):from dev.generate_swagger_specs import generate_specswritten_paths = generate_specs(tmp_path)@@ -691,7 +692,7 @@ def test_console_installed_plugin_ids_exported_schema_is_lightweight(tmp_path):}-def test_console_model_provider_summary_exported_schema_is_lightweight(tmp_path):+def test_console_model_provider_summary_exported_schema_is_lightweight(tmp_path: Path):from dev.generate_swagger_specs import generate_specswritten_paths = generate_specs(tmp_path)diff --git a/api/tests/unit_tests/core/tools/utils/test_misc_utils_extra.py b/api/tests/unit_tests/core/tools/utils/test_misc_utils_extra.pyindex afd2a1b8272..1c04b710806 100644--- a/api/tests/unit_tests/core/tools/utils/test_misc_utils_extra.py+++ b/api/tests/unit_tests/core/tools/utils/test_misc_utils_extra.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport uuidfrom contextlib import nullcontextfrom datetime import datetime+from pathlib import Pathfrom unittest.mock import patchimport pytest@@ -148,7 +149,7 @@ def test_is_valid_uuid_handles_valid_invalid_and_empty_values():assert is_valid_uuid(None) is False-def test_load_yaml_file_valid(tmp_path):+def test_load_yaml_file_valid(tmp_path: Path):valid_file = tmp_path / "valid.yaml"valid_file.write_text("a: 1\nb: two\n", encoding="utf-8")@@ -157,12 +158,12 @@ def test_load_yaml_file_valid(tmp_path):assert loaded == {"a": 1, "b": "two"}-def test_load_yaml_file_missing(tmp_path):+def test_load_yaml_file_missing(tmp_path: Path):with pytest.raises(FileNotFoundError):_load_yaml_file(file_path=str(tmp_path / "missing.yaml"))-def test_load_yaml_file_invalid(tmp_path):+def test_load_yaml_file_invalid(tmp_path: Path):invalid_file = tmp_path / "invalid.yaml"invalid_file.write_text("a: [1, 2\n", encoding="utf-8")@@ -170,7 +171,7 @@ def test_load_yaml_file_invalid(tmp_path):_load_yaml_file(file_path=str(invalid_file))-def test_load_yaml_file_cached_hits(tmp_path):+def test_load_yaml_file_cached_hits(tmp_path: Path):valid_file = tmp_path / "valid.yaml"valid_file.write_text("a: 1\nb: two\n", encoding="utf-8")diff --git a/api/tests/unit_tests/services/data_migration/test_package_service.py b/api/tests/unit_tests/services/data_migration/test_package_service.pyindex 2b80efcc6ef..3e85fff1ec0 100644--- a/api/tests/unit_tests/services/data_migration/test_package_service.py+++ b/api/tests/unit_tests/services/data_migration/test_package_service.py@@ -1,4 +1,5 @@import json+from pathlib import Pathimport pytest@@ -6,7 +7,7 @@ from services.data_migration.entities import MigrationDataErrorfrom services.data_migration.package_service import MigrationPackageService-def test_load_package_rejects_branch_draft_shape(tmp_path):+def test_load_package_rejects_branch_draft_shape(tmp_path: Path):package_file = tmp_path / "draft.json"package_file.write_text(json.dumps({"workflows": [], "tools": []}), encoding="utf-8")@@ -14,7 +15,7 @@ def test_load_package_rejects_branch_draft_shape(tmp_path):MigrationPackageService().load_package(package_file)-def test_load_package_rejects_unsupported_version(tmp_path):+def test_load_package_rejects_unsupported_version(tmp_path: Path):package_file = tmp_path / "future.json"package_file.write_text(json.dumps({"metadata": {"version": "999", "source_scope": "single"}}), encoding="utf-8")@@ -22,7 +23,7 @@ def test_load_package_rejects_unsupported_version(tmp_path):MigrationPackageService().load_package(package_file)-def test_save_package_writes_versioned_shape(tmp_path):+def test_save_package_writes_versioned_shape(tmp_path: Path):output_file = tmp_path / "migration-data.json"package = MigrationPackageService().build_empty_package(source_tenant_id="tenant-1",@@ -40,7 +41,7 @@ def test_save_package_writes_versioned_shape(tmp_path):assert data["dependencies"] == []-def test_save_package_without_overwrite_fails_when_file_exists(tmp_path):+def test_save_package_without_overwrite_fails_when_file_exists(tmp_path: Path):output_file = tmp_path / "migration-data.json"output_file.write_text("{}", encoding="utf-8")package = MigrationPackageService().build_empty_package(diff --git a/api/tests/unit_tests/services/plugin/test_plugin_migration.py b/api/tests/unit_tests/services/plugin/test_plugin_migration.pyindex f5462570b4e..068da9ba392 100644--- a/api/tests/unit_tests/services/plugin/test_plugin_migration.py+++ b/api/tests/unit_tests/services/plugin/test_plugin_migration.py@@ -1,4 +1,5 @@import json+from pathlib import Pathfrom types import SimpleNamespacefrom unittest.mock import MagicMock, patch@@ -120,7 +121,7 @@ class TestHandlePluginInstanceInstall:assert result["success"] == []assert result["failed"] == ["langgenius/openai"]- def test_install_plugins_invalidates_cache_after_direct_tenant_install(self, tmp_path) -> None:+ def test_install_plugins_invalidates_cache_after_direct_tenant_install(self, tmp_path: Path) -> None:extracted_plugins = tmp_path / "plugins.jsonl"output_file = tmp_path / "output.json"extracted_plugins.write_text('{"tenant_id":"tenant1","plugins":["langgenius/openai"]}\n')@@ -146,7 +147,7 @@ class TestHandlePluginInstanceInstall:mock_installer.install_from_identifiers.assert_called_once()invalidate_cache.assert_called_once_with("tenant1")- def test_install_plugins_reports_missing_plugin_ids(self, tmp_path) -> None:+ def test_install_plugins_reports_missing_plugin_ids(self, tmp_path: Path) -> None:extracted_plugins = tmp_path / "plugins.jsonl"output_file = tmp_path / "output.json"extracted_plugins.write_text('{"tenant_id":"tenant1","plugins":["langgenius/openai","langgenius/missing"]}\n')@@ -177,7 +178,7 @@ class TestHandlePluginInstanceInstall:]mock_installer.install_from_identifiers.assert_called_once()- def test_install_plugins_skips_unresolved_plugins(self, tmp_path) -> None:+ def test_install_plugins_skips_unresolved_plugins(self, tmp_path: Path) -> None:extracted_plugins = tmp_path / "plugins.jsonl"output_file = tmp_path / "output.json"extracted_plugins.write_text('{"tenant_id":"tenant1","plugins":["langgenius/missing"]}\n')