refactor(test): replace SimpleNamespace with typed mocks in schedule service tests#38393
Merged
asukaminato0721 merged 2 commits intoJul 7, 2026
Conversation
…service tests Replace the _workflow helper's SimpleNamespace cast with Mock(spec=Workflow) in test_schedule_service.py as part of langgenius#37604.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-07-03 12:19:39.993145440 +0000
+++ /tmp/pyrefly_pr.txt 2026-07-03 12:19:29.011148691 +0000
@@ -7320,13 +7320,13 @@
ERROR Argument `None` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
--> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:442:109
ERROR Argument `dict[str, Any]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
- --> tests/unit_tests/services/test_schedule_service.py:521:61
+ --> tests/unit_tests/services/test_schedule_service.py:536:61
ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
- --> tests/unit_tests/services/test_schedule_service.py:535:56
+ --> tests/unit_tests/services/test_schedule_service.py:550:56
ERROR Argument `dict[str, str | dict[str, str | dict[str, str]]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
- --> tests/unit_tests/services/test_schedule_service.py:552:61
+ --> tests/unit_tests/services/test_schedule_service.py:567:61
ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
- --> tests/unit_tests/services/test_schedule_service.py:564:56
+ --> tests/unit_tests/services/test_schedule_service.py:579:56
ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_dsl_service.SnippetDslService.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_snippet_dsl_service.py:33:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_dsl_service.SnippetDslService.import_snippet` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
Contributor
|
no, don't use Mock |
Replace Mock(spec=Workflow) with a real Workflow instance created via Workflow.new() per maintainer feedback on langgenius#37604.
Contributor
Author
|
Updated to use |
asukaminato0721
approved these changes
Jul 7, 2026
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.
#37604
Summary
Replaces the
_workflowhelper'sSimpleNamespacecast withMock(spec=Workflow)intest_schedule_service.py, matching the pattern already used elsewhere in the same file.From Cursor
Test plan
uv run pytest tests/unit_tests/services/test_schedule_service.py -q -o addopts=(50 passed)ruff checkon changed file