test: remove obsolete nonexistence checks
This commit is contained in:
1 parent
c08172a641
commit
3495281282
24 files changed
+8
-407
No files matched your search
@@ -83,19 +83,6 @@ _SINGLE_PLUGIN = ChannelPlugin(
|
||||
)
|
||||
|
||||
|
||||
def test_management_contract_is_not_declared_on_runtime_base_class() -> None:
|
||||
management_hooks = {
|
||||
"feature_instances",
|
||||
"instance_specs",
|
||||
"runtime_name",
|
||||
"supports_multiple_instances",
|
||||
"update_instance_config",
|
||||
}
|
||||
|
||||
assert management_hooks.isdisjoint(BaseChannel.__dict__.keys())
|
||||
assert "refresh_feature_metadata" in BaseChannel.__dict__
|
||||
|
||||
|
||||
def test_multi_instance_support_is_declared_by_management_spec() -> None:
|
||||
assert _SINGLE_PLUGIN.management.multi_instance is False
|
||||
assert load_channel_plugin("feishu").management.multi_instance is True
|
||||
|
||||
@@ -265,10 +265,8 @@ def test_channels_config_getattr_returns_extra():
|
||||
assert section["enabled"] is True
|
||||
|
||||
|
||||
def test_channels_config_has_no_per_channel_fields():
|
||||
"""After decoupling, ChannelsConfig has no explicit channel fields."""
|
||||
def test_channels_config_keeps_shared_delivery_defaults():
|
||||
cfg = ChannelsConfig()
|
||||
assert not hasattr(cfg, "telegram")
|
||||
assert cfg.send_progress is True
|
||||
assert cfg.send_tool_hints is True
|
||||
assert cfg.extract_document_text is True
|
||||
|
||||
@@ -98,7 +98,6 @@ def test_every_channel_is_a_self_contained_package() -> None:
|
||||
channel_dir = Path(channel_setup_module.__file__).parent
|
||||
package_names = {path.parent.name for path in channel_dir.glob("*/manifest.py")}
|
||||
|
||||
assert not hasattr(channel_setup_module, "CHANNEL_SETUP_SPECS")
|
||||
assert package_names == EXPECTED_CHANNELS
|
||||
assert set(discover_plugins()) == EXPECTED_CHANNELS
|
||||
for name in EXPECTED_CHANNELS:
|
||||
@@ -106,7 +105,6 @@ def test_every_channel_is_a_self_contained_package() -> None:
|
||||
assert (package_dir / "__init__.py").is_file()
|
||||
assert (package_dir / "manifest.py").is_file()
|
||||
assert (package_dir / "runtime.py").is_file()
|
||||
assert not (channel_dir / f"{name}.py").exists()
|
||||
|
||||
plugin = load_channel_package(name)
|
||||
assert plugin is not None
|
||||
@@ -165,27 +163,6 @@ def test_channel_manifests_only_import_contract_modules() -> None:
|
||||
assert not unexpected, f"{name} imports runtime dependencies: {unexpected}"
|
||||
|
||||
|
||||
def test_runtime_classes_do_not_declare_persisted_management_hooks() -> None:
|
||||
channel_dir = Path(channel_setup_module.__file__).parent
|
||||
management_hooks = {
|
||||
"feature_instances",
|
||||
"instance_specs",
|
||||
"runtime_name",
|
||||
"supports_multiple_instances",
|
||||
"update_instance_config",
|
||||
}
|
||||
for name in EXPECTED_CHANNELS:
|
||||
tree = ast.parse((channel_dir / name / "runtime.py").read_text(encoding="utf-8"))
|
||||
declared = {
|
||||
item.name
|
||||
for node in tree.body
|
||||
if isinstance(node, ast.ClassDef)
|
||||
for item in node.body
|
||||
if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef))
|
||||
}
|
||||
assert declared.isdisjoint(management_hooks), f"{name} runtime owns {declared & management_hooks}"
|
||||
|
||||
|
||||
def test_feishu_package_manifest_owns_runtime_and_webui_metadata() -> None:
|
||||
plugin = load_channel_package("feishu")
|
||||
|
||||
|
||||
Reference in new issue
Block a user