Skip to content

refactor(test): replace SimpleNamespace with typed mocks in schedule service tests#38393

Merged
asukaminato0721 merged 2 commits into
langgenius:mainfrom
ojasarora77:refactor/simplenamespace-test-schedule-service
Jul 7, 2026
Merged

refactor(test): replace SimpleNamespace with typed mocks in schedule service tests#38393
asukaminato0721 merged 2 commits into
langgenius:mainfrom
ojasarora77:refactor/simplenamespace-test-schedule-service

Conversation

@ojasarora77

@ojasarora77 ojasarora77 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

#37604

Summary

Replaces the _workflow helper's SimpleNamespace cast with Mock(spec=Workflow) in test_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 check on changed file

…service tests

Replace the _workflow helper's SimpleNamespace cast with Mock(spec=Workflow)
in test_schedule_service.py as part of langgenius#37604.
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. refactor labels Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → 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]

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 52.30% 52.30% 0.00%
Strict coverage 51.82% 51.82% 0.00%
Typed symbols 32,027 32,027 0
Untyped symbols 29,478 29,478 0
Modules 2970 2970 0

@asukaminato0721

Copy link
Copy Markdown
Contributor

no, don't use Mock

@asukaminato0721 asukaminato0721 self-assigned this Jul 3, 2026

@asukaminato0721 asukaminato0721 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Replace Mock(spec=Workflow) with a real Workflow instance created via
Workflow.new() per maintainer feedback on langgenius#37604.
@ojasarora77

Copy link
Copy Markdown
Contributor Author

Updated to use Workflow.new() instead of Mock — thanks for the review.

@asukaminato0721 asukaminato0721 enabled auto-merge July 7, 2026 14:35
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Jul 7, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 7, 2026
Merged via the queue into langgenius:main with commit 09c5c5e Jul 7, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants