test: replace logger patch with caplog in version and rag pipeline tests#37554
Merged
asukaminato0721 merged 1 commit intoJun 17, 2026
Merged
Conversation
asukaminato0721
approved these changes
Jun 17, 2026
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-17 01:38:12.491304738 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-17 01:37:58.734285297 +0000
@@ -1865,31 +1865,31 @@
ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
--> tests/unit_tests/controllers/common/test_fields.py:9:5
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:583:74
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:74
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:583:98
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:98
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:633:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:625:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:634:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:626:27
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:714:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:706:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:715:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:707:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:716:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:708:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:728:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:720:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:744:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:736:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:745:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:737:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:781:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:773:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:782:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:774:23
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:783:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:775:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -6067,33 +6067,33 @@
ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `recipients` with type `Sequence[HumanInputFormRecipient]` in function `repositories.sqlalchemy_api_workflow_run_repository._build_human_input_required_reason` [bad-argument-type]
--> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:56:9
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1331:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1273:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1390:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1329:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1459:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1398:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1514:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1453:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1546:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1485:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1578:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1517:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1624:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1563:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1684:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1623:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1754:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1693:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1787:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1726:21
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:1999:37
+ --> tests/unit_tests/services/agent/test_agent_services.py:1938:37
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2036:34
+ --> tests/unit_tests/services/agent/test_agent_services.py:1975:34
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2060:34
+ --> tests/unit_tests/services/agent/test_agent_services.py:1999:34
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2061:12
+ --> tests/unit_tests/services/agent/test_agent_services.py:2000:12
ERROR Object of class `NoneType` has no attribute `workflow_prompt` [missing-attribute]
--> tests/unit_tests/services/agent/test_composer_mention_validation.py:113:5
ERROR Class member `ConcreteApiKeyAuth.validate_credentials` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -6498,9 +6498,9 @@
ERROR Argument `dict[str, Any]` is not assignable to parameter `utm_info` with type `UtmInfo` in function `services.operation_service.OperationService.record_utm` [bad-argument-type]
--> tests/unit_tests/services/test_operation_service.py:117:57
ERROR Argument `Literal['']` 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:409:109
+ --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:410:109
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:431:109
+ --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:432: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
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]
|
Contributor
Pyrefly Type Coverage
|
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.
Summary
Part of #37468. Replaces
@patch(...logger...)/patch.object(logger, ...)mocking with pytest'scaplogfixture in two unit test files:tests/unit_tests/controllers/console/test_version.pytests/unit_tests/services/test_rag_pipeline_task_proxy.pycaplogcaptures the actual log output instead of asserting that a mocked logger method was called, which is less brittle (independent of logger names / import paths) and reduces boilerplate. This follows the existing pattern intests/unit_tests/libs/test_workspace_permission.py.Using
Refsrather thanFixesbecause #37468 spans ~8 files and is being open for the remaining files.Happy to follow up with the remaining files in separate PRs if this approach looks good.
Checklist
Refs #37468