Skip to content

test(api): make session decorator path assertion platform-agnostic - #39895

Open
AlexMultiAgent wants to merge 1 commit into
langgenius:mainfrom
AlexMultiAgent:fix/model-config-test-windows
Open

test(api): make session decorator path assertion platform-agnostic#39895
AlexMultiAgent wants to merge 1 commit into
langgenius:mainfrom
AlexMultiAgent:fix/model-config-test-windows

Conversation

@AlexMultiAgent

Copy link
Copy Markdown

test(api): make session decorator path assertion platform-agnostic

Fixes #39890

Summary

  • Normalize co_filename before comparing it in test_post_uses_one_session_and_rolls_back_when_signal_fails so the decorator unwrap loop terminates on Windows as well as POSIX.
  • No production behavior changes.

Root cause

The test walks the decorator chain with co_filename.endswith("controllers/common/session.py"). On Windows co_filename contains backslashes, so the condition never matches and the loop unwraps past the end of the chain, raising AttributeError: 'function' object has no attribute '__wrapped__'. The chain itself is intact.

Validation

  • Windows (Python 3.12): the previously failing test now passes.
  • Backend: test_model_config_api.py passes on POSIX as well.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

From Codex

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] test_model_config_api fails on Windows: decorator unwrap loop compares forward-slash path with backslash co_filename

1 participant