Skip to content

refactor: Use pytest caplog instead of logger patching in test_spec.py#37997

Merged
asukaminato0721 merged 2 commits into
langgenius:mainfrom
DevCube24:fix-logger-patching
Jun 26, 2026
Merged

refactor: Use pytest caplog instead of logger patching in test_spec.py#37997
asukaminato0721 merged 2 commits into
langgenius:mainfrom
DevCube24:fix-logger-patching

Conversation

@DevCube24

Copy link
Copy Markdown
Contributor

This PR addresses issue #37468 by refactoring the test test_get_exception_returns_empty_list in api/tests/unit_tests/controllers/console/test_spec.py to use pytest's caplog fixture instead of manually patching the logger.

This is part of a larger effort to modernize the test suite and improve log verification.

Changes:

  • Removed patch.object(spec_module.logger, "exception").
  • Added caplog fixture to the test method.
  • Asserted that the exception message is captured in caplog.text.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. refactor labels Jun 26, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 26, 2026
@asukaminato0721 asukaminato0721 changed the title Refactor: Use pytest caplog instead of logger patching in test_spec.py refactor: Use pytest caplog instead of logger patching in test_spec.py Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.34% 51.34% -0.00%
Strict coverage 50.86% 50.85% -0.00%
Typed symbols 30,576 30,576 0
Untyped symbols 29,254 29,255 +1
Modules 2930 2930 0

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Jun 26, 2026
Merged via the queue into langgenius:main with commit a66b1de Jun 26, 2026
31 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