mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5244
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4907
Author: @XiaoBinGan
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:fix/test-mcp-main-guard-last📝 Commits (1)
11eab2bFix #4906: a direct run of tools/test_strata_mcp.py runs every test📊 Changes
1 file changed (+4 additions, -4 deletions)
View changed files
📝
tools/test_strata_mcp.py(+4 -4)📄 Description
Problem and result
tools/test_strata_mcp.pystopped its own run before the end when executed directly: theif __name__ == "__main__": unittest.main()block sat at line 937 of 1112, and the last three test classes(
RemoveMissingFilesTest,DiskUsageTest,DraftLayerAndCancel) were appended after it in later commits(
917d2fc3,31030b17).unittest.main()only collects the classes defined at the moment it runs, so a direct runran 45 of the file's 52 tests and silently skipped the other 7 — the delete-already-gone, disk-usage and draft-layer
checks.
Related discussion
#4906 — the report I opened for this, with the same counts. A test-harness fix, not a behaviour change; no scope
agreement was asked for.
Approach
if __name__ == "__main__": unittest.main()block moves from the middle of the file to the end, afterDraftLayerAndCancel, so every class in the file is defined before unittest collects them.python -m unittest tools.test_strata_mcpandpython -m pytest tools/test_strata_mcp.pyalready collected all 52 classes and behavethe same after the move.
Validation
Passed: the previously unreachable classes on the branch,
python tools/test_strata_mcp.py DiskUsageTest:Ran 3 tests, OK;
python tools/test_strata_mcp.py RemoveMissingFilesTest: Ran 1 test, OK.Passed: the full direct run on the branch,
python tools/test_strata_mcp.py: Ran 52 tests, 1 failure — theMacCatalog::test_deepseek_on_a_mac_offers_the_two_sets_that_were_run_with_the_mac_wordscheck, which already failson unmodified
mainunder pytest and is tracked separately as #4904 (fix in #4905). The 7 tests this change putsback all pass.
Passed:
python -m pytest tools/test_strata_mcp.py -qon the branch still collects the same 52 tests (sameresult as
main: 1 failed, 51 passed, the #4904 check).Failed: on unmodified
main,python tools/test_strata_mcp.py→ Ran 45 tests, andpython tools/test_strata_mcp.py DiskUsageTest→AttributeError: module '__main__' has no attribute 'DiskUsageTest'. That is the A/B.Not run: the other tools' test files were not changed by this.
Limits
python -m unittest tools/test_strata_mcp.py -v) already ran all 52 tests; thisfixes the direct run that the other
tools/test_*.pyfiles use, which is where the 7 were missing.not part of this change, and the direct run reports it exactly as the pytest run does.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.