Skip to content

armgit / dify

Public Imported from GitHub
0

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.

test(api): annotate three more test modules so strict pyrefly can check them (#45338)

Felix Shic3bfb355bea0
diff --git a/api/tests/unit_tests/commands/test_data_migration.py b/api/tests/unit_tests/commands/test_data_migration.py
index 92f9df31884..50c91a48da2 100644
--- a/api/tests/unit_tests/commands/test_data_migration.py
+++ b/api/tests/unit_tests/commands/test_data_migration.py
@@ -54,6 +54,7 @@ from services.data_migration.entities import (
MigrationPackage,
ReportContext,
)
+from services.data_migration.import_service import ImportRequest
from services.enterprise.rbac_service import ReplaceMemberBindings, ReplaceUserAccessPolicies
from tests.helpers.legacy_model_type_migration import (
ALL_TABLE_NAMES,
@@ -76,7 +77,7 @@ CLI parsing and session lifecycle without fabricating the SQLAlchemy boundary.
class TestDataMigrationCommandsCases:
@staticmethod
- def test_export_command_requires_input_and_output():
+ def test_export_command_requires_input_and_output() -> None:
result = CliRunner().invoke(export_migration_data, [])
assert result.exit_code != 0
@@ -85,7 +86,7 @@ class TestDataMigrationCommandsCases:
assert "--output" in result.output
@staticmethod
- def test_import_command_requires_input_and_target_tenant_or_package_metadata():
+ def test_import_command_requires_input_and_target_tenant_or_package_metadata() -> None:
result = CliRunner().invoke(import_migration_data, [])
assert result.exit_code != 0
@@ -93,11 +94,11 @@ class TestDataMigrationCommandsCases:
assert "--input" in result.output
@staticmethod
- def test_import_command_does_not_expose_unimplemented_map_id_strategy():
+ def test_import_command_does_not_expose_unimplemented_map_id_strategy() -> None:
assert ID_STRATEGY_CHOICES == ["preserve-id", "generate-new-id"]
@staticmethod
- def test_export_template_command_prints_scripted_json_template():
+ def test_export_template_command_prints_scripted_json_template() -> None:
result = CliRunner().invoke(export_migration_data_template, [])
assert result.exit_code == 0
@@ -117,7 +118,7 @@ class TestDataMigrationCommandsCases:
}
@staticmethod
- def test_export_template_command_writes_output_file(tmp_path: Path):
+ def test_export_template_command_writes_output_file(tmp_path: Path) -> None:
output_file = tmp_path / "export-template.json"
result = CliRunner().invoke(export_migration_data_template, ["--output", str(output_file)])
@@ -127,7 +128,7 @@ class TestDataMigrationCommandsCases:
assert json.loads(output_file.read_text())["apps"]["all"] is True
@staticmethod
- def test_export_template_command_requires_overwrite_for_existing_output(tmp_path: Path):
+ def test_export_template_command_requires_overwrite_for_existing_output(tmp_path: Path) -> None:
output_file = tmp_path / "export-template.json"
output_file.write_text("{}")
@@ -137,7 +138,9 @@ class TestDataMigrationCommandsCases:
assert "already exists" in result.output
@staticmethod
- def test_export_command_uses_cli_owned_session(monkeypatch, tmp_path: Path, sqlite_engine: Engine):
+ def test_export_command_uses_cli_owned_session(
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, sqlite_engine: Engine
+ ) -> None:
captured: dict[str, object] = {}
input_file = tmp_path / "export-config.json"
output_file = tmp_path / "migration-package.json"
@@ -145,13 +148,13 @@ class TestDataMigrationCommandsCases:
package = MigrationPackage.from_mapping({"metadata": {"version": "1", "source_scope": "single"}})
class FakeMigrationExportService:
- def export(self, selection, *, session):
+ def export(self, selection: object, *, session: Session) -> ExportResult:
captured["session"] = session
captured["selection"] = selection
return ExportResult(package=package, report_items=[], report_context=ReportContext())
class FakeMigrationPackageService:
- def save_package(self, package_to_save, path, *, overwrite):
+ def save_package(self, package_to_save: MigrationPackage, path: str, *, overwrite: bool) -> None:
captured["package"] = package_to_save
captured["path"] = path
captured["overwrite"] = overwrite
@@ -174,7 +177,9 @@ class TestDataMigrationCommandsCases:
assert captured["overwrite"] is False
@staticmethod
- def test_import_command_uses_cli_owned_session(monkeypatch, tmp_path: Path, sqlite_engine: Engine):
+ def test_import_command_uses_cli_owned_session(
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, sqlite_engine: Engine
+ ) -> None:
captured: dict[str, object] = {}
input_file = tmp_path / "migration-package.json"
input_file.write_text("{}")
@@ -190,13 +195,13 @@ class TestDataMigrationCommandsCases:
)
class FakeMigrationImportService:
- def import_package(self, request, *, session):
+ def import_package(self, request: ImportRequest, *, session: Session) -> ImportResult:
captured["session"] = session
captured["request"] = request
return ImportResult(report_items=[], report_context=ReportContext(target_tenant="target"))
class FakeMigrationPackageService:
- def load_package(self, path):
+ def load_package(self, path: str) -> MigrationPackage:
captured["path"] = path
return package
@@ -215,6 +220,7 @@ class TestDataMigrationCommandsCases:
assert captured_session.in_transaction() is False
assert captured["path"] == str(input_file)
request = captured["request"]
+ assert isinstance(request, ImportRequest)
assert request.package is package
assert request.options_override == ImportOptions(conflict_strategy=ConflictStrategy.SKIP)
diff --git a/api/tests/unit_tests/controllers/common/test_schema.py b/api/tests/unit_tests/controllers/common/test_schema.py
index 3cbab70e26b..a626cc61641 100644
--- a/api/tests/unit_tests/controllers/common/test_schema.py
+++ b/api/tests/unit_tests/controllers/common/test_schema.py
@@ -97,20 +97,20 @@ def _make_same_named_model() -> type[BaseModel]:
class TestSchemaCases:
@staticmethod
@pytest.fixture(autouse=True)
- def console_ns():
+ def console_ns() -> Iterator[Namespace]:
"""Isolate the console import while exercising a real namespace."""
namespace = Namespace("console")
with patch.dict(sys.modules, {"controllers.console": SimpleNamespace(console_ns=namespace)}):
yield namespace
@staticmethod
- def test_default_ref_template_value():
+ def test_default_ref_template_value() -> None:
from controllers.common.schema import DEFAULT_REF_TEMPLATE_OPENAPI_3_0
assert DEFAULT_REF_TEMPLATE_OPENAPI_3_0 == "#/components/schemas/{model}"
@staticmethod
- def test_register_schema_model_calls_namespace_schema_model():
+ def test_register_schema_model_calls_namespace_schema_model() -> None:
from controllers.common.schema import register_schema_model
namespace = Namespace("test")
@@ -123,7 +123,7 @@ class TestSchemaCases:
assert "properties" in schema
@staticmethod
- def test_register_schema_model_passes_schema_from_pydantic():
+ def test_register_schema_model_passes_schema_from_pydantic() -> None:
from controllers.common.schema import DEFAULT_REF_TEMPLATE_OPENAPI_3_0, register_schema_model
namespace = Namespace("test")
@@ -137,7 +137,7 @@ class TestSchemaCases:
assert schema == expected_schema
@staticmethod
- def test_register_schema_model_promotes_nested_pydantic_definitions():
+ def test_register_schema_model_promotes_nested_pydantic_definitions() -> None:
from controllers.common.schema import DEFAULT_REF_TEMPLATE_OPENAPI_3_0, register_schema_model
namespace = Namespace("test")
@@ -153,7 +153,7 @@ class TestSchemaCases:
assert called_schemas["ChildModel"] == parent_schema["$defs"]["ChildModel"]
@staticmethod
- def test_register_schema_model_allows_reregistering_the_same_model():
+ def test_register_schema_model_allows_reregistering_the_same_model() -> None:
from controllers.common.schema import register_schema_model
namespace = Namespace("test")
@@ -165,7 +165,7 @@ class TestSchemaCases:
@staticmethod
@pytest.mark.parametrize("strict", [False, True])
- def test_register_schema_model_keeps_annotated_enum_names_stable(strict: bool):
+ def test_register_schema_model_keeps_annotated_enum_names_stable(strict: bool) -> None:
from controllers.common.schema import register_schema_model
enum_types = [StrEnum("StableStatus", {"ACTIVE": "active"}, module=__name__) for _ in range(2)]
@@ -181,7 +181,7 @@ class TestSchemaCases:
assert snapshots[0] == snapshots[1]
@staticmethod
- def test_register_schema_model_rejects_different_model_with_same_name():
+ def test_register_schema_model_rejects_different_model_with_same_name() -> None:
from controllers.common.schema import SchemaNameCollisionError, register_schema_model
namespace = Namespace("test")
@@ -191,7 +191,7 @@ class TestSchemaCases:
register_schema_model(namespace, _make_same_named_model())
@staticmethod
- def test_register_schema_model_rejects_nested_definition_with_same_name():
+ def test_register_schema_model_rejects_nested_definition_with_same_name() -> None:
from controllers.common.schema import SchemaNameCollisionError, register_schema_model
other_child = create_model("ChildModel", __module__="other_module", other=(int, ...))
@@ -203,7 +203,7 @@ class TestSchemaCases:
register_schema_model(namespace, other_parent)
@staticmethod
- def test_register_schema_model_rejects_same_named_types_inside_one_schema():
+ def test_register_schema_model_rejects_same_named_types_inside_one_schema() -> None:
from controllers.common.schema import SchemaNameCollisionError, register_schema_model
other_child = create_model("ChildModel", __module__="other_module", other=(int, ...))
@@ -213,7 +213,7 @@ class TestSchemaCases:
register_schema_model(Namespace("test"), both_children)
@staticmethod
- def test_register_schema_model_rejects_model_registered_in_both_modes_with_different_shapes():
+ def test_register_schema_model_rejects_model_registered_in_both_modes_with_different_shapes() -> None:
from controllers.common.schema import (
SchemaNameCollisionError,
register_response_schema_model,
@@ -227,7 +227,7 @@ class TestSchemaCases:
register_schema_model(namespace, ResponseAliasModel)
@staticmethod
- def test_register_schema_model_rejects_names_that_collide_after_normalization():
+ def test_register_schema_model_rejects_names_that_collide_after_normalization() -> None:
from controllers.common.schema import SchemaNameCollisionError, register_schema_model
namespace = Namespace("test")
@@ -237,14 +237,14 @@ class TestSchemaCases:
register_schema_model(namespace, create_model("JsonPayload", value=(str, ...)))
@staticmethod
- def test_register_schema_model_keeps_namespaces_independent():
+ def test_register_schema_model_keeps_namespaces_independent() -> None:
from controllers.common.schema import register_schema_model
register_schema_model(Namespace("first"), UserModel)
register_schema_model(Namespace("second"), _make_same_named_model())
@staticmethod
- def test_register_schema_model_applies_schema_name_overrides(monkeypatch: pytest.MonkeyPatch):
+ def test_register_schema_model_applies_schema_name_overrides(monkeypatch: pytest.MonkeyPatch) -> None:
from controllers.common import schema as schema_module
monkeypatch.setattr(
@@ -261,7 +261,7 @@ class TestSchemaCases:
assert parent_schema["properties"]["child"]["$ref"] == "#/components/schemas/RenamedChildModel"
@staticmethod
- def test_register_schema_models_registers_multiple_models():
+ def test_register_schema_models_registers_multiple_models() -> None:
from controllers.common.schema import register_schema_models
namespace = Namespace("test")
@@ -272,14 +272,14 @@ class TestSchemaCases:
assert called_names == ["UserModel", "ProductModel"]
@staticmethod
- def test_register_schema_models_calls_register_schema_model(monkeypatch: pytest.MonkeyPatch):
+ def test_register_schema_models_calls_register_schema_model(monkeypatch: pytest.MonkeyPatch) -> None:
from controllers.common.schema import register_schema_models
namespace = Namespace("test")
calls = []
- def fake_register(ns, model):
+ def fake_register(ns: Namespace, model: type[BaseModel]) -> None:
calls.append((ns, model))
monkeypatch.setattr(
@@ -295,7 +295,7 @@ class TestSchemaCases:
]
@staticmethod
- def test_register_response_schema_model_uses_serialized_field_names():
+ def test_register_response_schema_model_uses_serialized_field_names() -> None:
from controllers.common.schema import register_response_schema_model
namespace = Namespace("test")
@@ -308,7 +308,7 @@ class TestSchemaCases:
assert "internal_name" not in schema["properties"]
@staticmethod
- def test_register_schema_model_preserves_openapi_nullable_unions():
+ def test_register_schema_model_preserves_openapi_nullable_unions() -> None:
from controllers.common.schema import register_schema_model
namespace = Namespace("test")
@@ -324,7 +324,7 @@ class TestSchemaCases:
assert "anyOf" in properties["ambiguous"]
@staticmethod
- def test_get_or_create_model_returns_existing_model(console_ns):
+ def test_get_or_create_model_returns_existing_model(console_ns: Namespace) -> None:
from controllers.common.schema import get_or_create_model
existing_model = console_ns.model("TestModel", {"name": fields.String})
@@ -335,7 +335,7 @@ class TestSchemaCases:
assert len(console_ns.models) == 1
@staticmethod
- def test_get_or_create_model_creates_new_model_when_not_exists(console_ns):
+ def test_get_or_create_model_creates_new_model_when_not_exists(console_ns: Namespace) -> None:
from controllers.common.schema import get_or_create_model
field_def = {"name": fields.String}
@@ -346,7 +346,7 @@ class TestSchemaCases:
assert result.__schema__["properties"] == {"name": {"type": "string"}}
@staticmethod
- def test_get_or_create_model_does_not_call_model_if_exists(console_ns):
+ def test_get_or_create_model_does_not_call_model_if_exists(console_ns: Namespace) -> None:
from controllers.common.schema import get_or_create_model
existing_model = console_ns.model("ExistingModel", {"name": fields.String})
@@ -357,7 +357,7 @@ class TestSchemaCases:
assert len(console_ns.models) == 1
@staticmethod
- def test_register_enum_models_registers_single_enum():
+ def test_register_enum_models_registers_single_enum() -> None:
from controllers.common.schema import register_enum_models
namespace = Namespace("test")
@@ -369,7 +369,7 @@ class TestSchemaCases:
assert isinstance(schema, dict)
@staticmethod
- def test_register_enum_models_registers_multiple_enums():
+ def test_register_enum_models_registers_multiple_enums() -> None:
from controllers.common.schema import register_enum_models
namespace = Namespace("test")
@@ -380,7 +380,7 @@ class TestSchemaCases:
assert called_names == ["StatusEnum", "PriorityEnum"]
@staticmethod
- def test_register_enum_models_uses_correct_ref_template():
+ def test_register_enum_models_uses_correct_ref_template() -> None:
from controllers.common.schema import register_enum_models
namespace = Namespace("test")
@@ -393,7 +393,7 @@ class TestSchemaCases:
assert "enum" in schema or "anyOf" in schema
@staticmethod
- def test_query_params_from_model_builds_flask_restx_doc_params():
+ def test_query_params_from_model_builds_flask_restx_doc_params() -> None:
from controllers.common.schema import query_params_from_model
params = query_params_from_model(QueryModel)
@@ -458,7 +458,7 @@ class TestSchemaCases:
}
@staticmethod
- def test_query_params_from_request_preserves_repeated_list_params():
+ def test_query_params_from_request_preserves_repeated_list_params() -> None:
from controllers.common.schema import query_params_from_request
app = Flask(__name__)
@@ -471,7 +471,7 @@ class TestSchemaCases:
assert query.keyword == "hello"
@staticmethod
- def test_query_params_from_request_raises_for_malformed_ints_by_default():
+ def test_query_params_from_request_raises_for_malformed_ints_by_default() -> None:
from controllers.common.schema import query_params_from_request
app = Flask(__name__)
@@ -480,7 +480,7 @@ class TestSchemaCases:
query_params_from_request(HelperQueryModel, list_fields=("status",))
@staticmethod
- def test_query_params_from_request_can_use_model_default_for_malformed_defaulted_ints():
+ def test_query_params_from_request_can_use_model_default_for_malformed_defaulted_ints() -> None:
from controllers.common.schema import query_params_from_request
app = Flask(__name__)
diff --git a/api/tests/unit_tests/dev/test_generate_swagger_markdown_docs.py b/api/tests/unit_tests/dev/test_generate_swagger_markdown_docs.py
index 87795748909..693642646bd 100644
--- a/api/tests/unit_tests/dev/test_generate_swagger_markdown_docs.py
+++ b/api/tests/unit_tests/dev/test_generate_swagger_markdown_docs.py
@@ -2,13 +2,15 @@
import importlib.util
import json
+import subprocess
import sys
from pathlib import Path
+from types import ModuleType
import pytest
-def _load_generate_swagger_markdown_docs_module():
+def _load_generate_swagger_markdown_docs_module() -> ModuleType:
api_dir = Path(__file__).resolve().parents[3]
script_path = api_dir / "dev" / "generate_swagger_markdown_docs.py"
@@ -24,7 +26,7 @@ def _load_generate_swagger_markdown_docs_module():
def test_generate_markdown_docs_keeps_split_docs_and_merges_fastopenapi_into_console(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
-):
+) -> None:
module = _load_generate_swagger_markdown_docs_module()
openapi_dir = tmp_path / "openapi"
markdown_dir = tmp_path / "markdown"
@@ -75,7 +77,7 @@ def test_generate_markdown_docs_keeps_split_docs_and_merges_fastopenapi_into_con
def test_generate_markdown_docs_only_removes_generated_specs_from_separate_swagger_dir(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
-):
+) -> None:
module = _load_generate_swagger_markdown_docs_module()
swagger_dir = tmp_path / "swagger"
markdown_dir = tmp_path / "markdown"
@@ -111,7 +113,7 @@ def test_generate_markdown_docs_only_removes_generated_specs_from_separate_swagg
assert not list(swagger_dir.glob("*.json"))
-def test_patch_union_schema_markdown_fills_converter_blank_schema_types(tmp_path: Path):
+def test_patch_union_schema_markdown_fills_converter_blank_schema_types(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text(
@@ -197,7 +199,7 @@ def test_patch_union_schema_markdown_fills_converter_blank_schema_types(tmp_path
assert "| allowed_file_types | [ [FileType](#filetype) ] | | No |" in patched
-def test_patch_union_schema_markdown_fills_regular_schema_union_property(tmp_path: Path):
+def test_patch_union_schema_markdown_fills_regular_schema_union_property(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "service-openapi.json"
spec_path.write_text(
@@ -238,7 +240,7 @@ def test_patch_union_schema_markdown_fills_regular_schema_union_property(tmp_pat
assert "| value | string<br>integer<br>number<br>boolean | | No |" in patched
-def test_patch_union_schema_markdown_preserves_nullable_enum_values(tmp_path: Path):
+def test_patch_union_schema_markdown_preserves_nullable_enum_values(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text(
@@ -274,7 +276,7 @@ def test_patch_union_schema_markdown_preserves_nullable_enum_values(tmp_path: Pa
assert '| task_id | string, <br>**Available values:** "home", "studio" | Task ID | No |' in patched
-def test_patch_union_schema_markdown_fills_array_item_union_property(tmp_path: Path):
+def test_patch_union_schema_markdown_fills_array_item_union_property(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text(
@@ -319,7 +321,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: Path):
+def test_patch_union_schema_markdown_ignores_specs_without_schemas(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text("{}", encoding="utf-8")
@@ -327,7 +329,7 @@ def test_patch_union_schema_markdown_ignores_specs_without_schemas(tmp_path: Pat
assert module._patch_union_schema_markdown("unchanged", spec_path) == "unchanged"
-def test_patch_union_response_markdown_fills_converter_blank_error_bodies(tmp_path: Path):
+def test_patch_union_response_markdown_fills_converter_blank_error_bodies(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text(
@@ -393,7 +395,7 @@ def test_patch_union_response_markdown_fills_converter_blank_error_bodies(tmp_pa
assert patched.endswith("| 400 | Bad Request | **application/json**: <br> |\n")
-def test_patch_wildcard_media_type_markdown_preserves_literal_wildcard():
+def test_patch_wildcard_media_type_markdown_preserves_literal_wildcard() -> None:
module = _load_generate_swagger_markdown_docs_module()
patched = module._patch_wildcard_media_type_markdown("| 200 | Raw file. | ***/***: binary<br> |\n")
@@ -401,13 +403,13 @@ def test_patch_wildcard_media_type_markdown_preserves_literal_wildcard():
assert patched == "| 200 | Raw file. | `*/*`: binary<br> |\n"
-def test_drop_null_values_for_markdown_does_not_mutate_openapi_source():
+def test_drop_null_values_for_markdown_does_not_mutate_openapi_source() -> None:
module = _load_generate_swagger_markdown_docs_module()
payload = {
"schema": {
"default": None,
"enum": ["value", None],
- "properties": {"nullable": {"default": None}},
+ "properties": {"nullable": {"default": None}}, # pyrefly: ignore[implicit-any-empty-container]
}
}
@@ -423,7 +425,7 @@ def test_drop_null_values_for_markdown_does_not_mutate_openapi_source():
assert payload["schema"]["properties"]["nullable"]["default"] is None
-def test_patch_union_schema_markdown_ignores_unrenderable_shapes(tmp_path: Path):
+def test_patch_union_schema_markdown_ignores_unrenderable_shapes(tmp_path: Path) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
spec_path.write_text(
@@ -471,14 +473,14 @@ def test_patch_union_schema_markdown_ignores_unrenderable_shapes(tmp_path: Path)
def test_convert_spec_to_markdown_logs_converter_failure_without_overwriting_docs(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
-):
+) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
output_path = tmp_path / "console-openapi.md"
spec_path.write_text("{}", encoding="utf-8")
output_path.write_text("Existing documentation\n", encoding="utf-8")
- def run_converter(args, **_kwargs):
+ def run_converter(args: list[str], **_kwargs: object) -> subprocess.CompletedProcess[str]:
return module.subprocess.CompletedProcess(
args=args, returncode=1, stdout="Loading converter", stderr="Unable to resolve npm runtime"
)
@@ -501,7 +503,7 @@ def test_convert_spec_to_markdown_logs_converter_failure_without_overwriting_doc
@pytest.mark.parametrize("content_count", [1, 2, 3])
def test_convert_spec_to_markdown_patches_generated_union_tables(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, required: str, content_count: int
-):
+) -> None:
module = _load_generate_swagger_markdown_docs_module()
spec_path = tmp_path / "console-openapi.json"
output_path = tmp_path / "console-openapi.md"
@@ -536,7 +538,7 @@ def test_convert_spec_to_markdown_patches_generated_union_tables(
media_types = ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"][:content_count]
body_schema = "".join(f"**{media_type}**: string, enum: a\\|b<br>" for media_type in media_types)
- def run_converter(args, **kwargs):
+ def run_converter(args: list[str], **kwargs: object) -> subprocess.CompletedProcess[str]:
assert kwargs["check"] is False
converter_spec_path = Path(args[args.index("-i") + 1])
assert converter_spec_path != spec_path
@@ -585,7 +587,7 @@ def test_convert_spec_to_markdown_patches_generated_union_tables(
assert [cell.strip() for cell in body_row.strip("|").split(" | ")] == [required, body_schema]
-def test_request_body_patch_preserves_distinct_cells_and_other_tables():
+def test_request_body_patch_preserves_distinct_cells_and_other_tables() -> None:
module = _load_generate_swagger_markdown_docs_module()
markdown = """| Required | Schema |
| -------- | ------ |
diff --git a/api/tests/unit_tests/pyrefly.toml b/api/tests/unit_tests/pyrefly.toml
index 9691c47298e..558657c644c 100644
--- a/api/tests/unit_tests/pyrefly.toml
+++ b/api/tests/unit_tests/pyrefly.toml
@@ -9,14 +9,11 @@ min-severity = "warn"
# Existing strict-mode debt. Remove a file when bringing it under strict checking.
project-excludes = [
"commands/test_retention.py",
- "commands/test_data_migration.py",
- "dev/test_generate_swagger_markdown_docs.py",
"dev/test_generate_swagger_specs.py",
"commands/test_system.py",
"repositories/test_app_definition_query_repository.py",
"controllers/common/test_errors.py",
"controllers/common/test_file_response.py",
- "controllers/common/test_schema.py",
"controllers/console/app/test_agent_config_inspector.py",
"controllers/console/app/test_annotation.py",
"controllers/console/app/test_app.py",