aminghadersohi opened a new pull request, #36279:
URL: https://github.com/apache/superset/pull/36279

   ### SUMMARY
   Two tests in `TestDatasetSortableColumns` were failing with `AttributeError: 
'function' object has no attribute 'fn'` because they were trying to call 
`list_datasets.fn()` directly.
   
   The `@tool` and `@parse_request` decorators don't expose a `.fn` attribute 
on the decorated function. The correct way to test MCP tools is to use the 
FastMCP `Client` pattern.
   
   **Fixed tests:**
   - `test_list_datasets_with_valid_order_column` - tests list_datasets with 
valid sortable column
   - `test_default_ordering` - tests default ordering behavior when no 
order_column is specified
   
   Both tests now use `async with Client(mcp_server)` and `client.call_tool()` 
to properly invoke the MCP tool, matching the pattern used in all other MCP 
service tests.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A - test fix only
   
   ### TESTING INSTRUCTIONS
   1. Run the failing tests before fix:
      ```bash
      pytest 
tests/unit_tests/mcp_service/dataset/tool/test_dataset_tools.py::TestDatasetSortableColumns::test_list_datasets_with_valid_order_column
      pytest 
tests/unit_tests/mcp_service/dataset/tool/test_dataset_tools.py::TestDatasetSortableColumns::test_default_ordering
      ```
      Both should fail with `AttributeError: 'function' object has no attribute 
'fn'`
   
   2. Run all MCP service tests to verify fix and no regressions:
      ```bash
      pytest tests/unit_tests/mcp_service
      ```
      All 240 tests should pass.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to