Skip to content

Conversation

@aminghadersohi
Copy link
Contributor

@aminghadersohi aminghadersohi commented Nov 26, 2025

SUMMARY

Fixed two failing unit tests in the MCP dataset tools test suite by updating them to use the proper MCP client testing pattern.

The tests were incorrectly trying to call the list_datasets function directly, which is decorated with @tool from superset_core.mcp. The fix updates the tests to use the MCP client approach (via async with Client(mcp_server)) to call the tools, matching the pattern used in other MCP test files (e.g., dashboard tests).

Failing tests:

  • TestDatasetSortableColumns::test_list_datasets_with_valid_order_column
  • TestDatasetSortableColumns::test_default_ordering

Changes:

  • Updated both tests to use async with Client(mcp_server) as client and client.call_tool()
  • Removed direct function calls and manual context mocking
  • Added response verification to ensure proper data structure
  • Follows the same pattern as dashboard tool tests

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A - Test fix only

TESTING INSTRUCTIONS

  1. Run the previously failing tests:
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
  1. Verify all tests in the file pass:
pytest tests/unit_tests/mcp_service/dataset/tool/test_dataset_tools.py -v

Expected: All 20 tests pass

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Nov 26, 2025

Code Review Agent Run #4cddee

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 22b7224..22b7224
    • tests/unit_tests/mcp_service/dataset/tool/test_dataset_tools.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.99%. Comparing base (76d897e) to head (70a3560).
⚠️ Report is 2971 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #36295      +/-   ##
==========================================
+ Coverage   60.48%   67.99%   +7.50%     
==========================================
  Files        1931      636    -1295     
  Lines       76236    46817   -29419     
  Branches     8568     5081    -3487     
==========================================
- Hits        46114    31831   -14283     
+ Misses      28017    13710   -14307     
+ Partials     2105     1276     -829     
Flag Coverage Δ
hive 43.75% <ø> (-5.41%) ⬇️
javascript ?
mysql 67.09% <ø> (?)
postgres 67.14% <ø> (?)
presto 47.35% <ø> (-6.46%) ⬇️
python 67.95% <ø> (+4.45%) ⬆️
sqlite 66.76% <ø> (?)
unit 100.00% <ø> (+42.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi aminghadersohi force-pushed the amin/fix-dataset-tools-tests branch from 22b7224 to d5e34ec Compare November 26, 2025 16:20
@aminghadersohi aminghadersohi force-pushed the amin/fix-dataset-tools-tests branch from d5e34ec to d559471 Compare November 26, 2025 17:06
The list_datasets function is decorated with @tool, which makes it a
FunctionTool object. Tests that directly call the function need to
access the underlying wrapped function using __wrapped__.

This fixes two failing tests:
- TestDatasetSortableColumns::test_list_datasets_with_valid_order_column
- TestDatasetSortableColumns::test_default_ordering
@aminghadersohi aminghadersohi force-pushed the amin/fix-dataset-tools-tests branch 2 times, most recently from cdd2210 to 70a3560 Compare November 26, 2025 17:12
Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez left a comment

Choose a reason for hiding this comment

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

lgtm

@Antonio-RiveroMartnez Antonio-RiveroMartnez merged commit 2af5a5a into apache:master Nov 26, 2025
84 of 115 checks passed
kshi020302 pushed a commit to jl141/superset that referenced this pull request Nov 30, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 4, 2025
Facyla pushed a commit to Facyla/superset-contrib that referenced this pull request Dec 16, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 16, 2025
aminghadersohi added a commit to aminghadersohi/superset that referenced this pull request Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants