Skip to content

Commit bbf96c4

Browse files
committed
Fix CI mypy errors in IWC test fixtures
The CI mypy job fails on pre-existing tests where the SAMPLE_MANIFEST dict literal narrows steps to Collection[str] (so step["0"] becomes "not indexable"), and where AgentOperationsManager is constructed with SimpleNamespace stand-ins for app/trans. Annotate the manifest fixture as list[dict[str, Any]] and cast() the SimpleNamespace args so the type-only assertions still pass without changing behavior.
1 parent e1ebfdf commit bbf96c4

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

test/unit/agents/test_iwc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
from typing import (
2+
Any,
3+
)
14
from unittest.mock import patch
25

36
import pytest
47

58
from galaxy.agents import iwc
69

7-
SAMPLE_MANIFEST = [
10+
SAMPLE_MANIFEST: list[dict[str, Any]] = [
811
{
912
"workflows": [
1013
{

test/unit/agents/test_operations_iwc.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
from types import SimpleNamespace
2+
from typing import (
3+
Any,
4+
cast,
5+
)
26
from unittest.mock import patch
37

48
from galaxy.agents.operations import AgentOperationsManager
9+
from galaxy.managers.context import ProvidesUserContext
10+
from galaxy.structured_app import MinimalManagerApp
511

612

713
class MutatingWorkflowContentsManager:
@@ -17,7 +23,7 @@ def build_workflow_from_raw_description(self, trans, raw_workflow_description, c
1723

1824

1925
def test_import_workflow_from_iwc_does_not_mutate_cached_definition():
20-
definition = {
26+
definition: dict[str, Any] = {
2127
"name": "IWC workflow with subworkflow",
2228
"annotation": "",
2329
"tags": [],
@@ -46,7 +52,7 @@ def test_import_workflow_from_iwc_does_not_mutate_cached_definition():
4652
]
4753
app = SimpleNamespace(workflow_contents_manager=MutatingWorkflowContentsManager())
4854
trans = SimpleNamespace(security=SimpleNamespace(encode_id=lambda value: f"encoded-{value}"))
49-
ops = AgentOperationsManager(app, trans)
55+
ops = AgentOperationsManager(cast(MinimalManagerApp, app), cast(ProvidesUserContext, trans))
5056

5157
with patch("galaxy.agents.iwc.fetch_manifest", return_value=manifest):
5258
result = ops.import_workflow_from_iwc("#workflow/github.com/iwc-workflows/with-subworkflow/main")

0 commit comments

Comments
 (0)