feat: add comprehensive unit tests for bittensor.core.threadpool module#3169
Merged
basfroman merged 3 commits intoopentensor:SDKv10from Dec 8, 2025
Merged
feat: add comprehensive unit tests for bittensor.core.threadpool module#3169basfroman merged 3 commits intoopentensor:SDKv10from
basfroman merged 3 commits intoopentensor:SDKv10from
Conversation
basfroman
requested changes
Dec 7, 2025
Collaborator
basfroman
left a comment
There was a problem hiding this comment.
Please pull SDKv10 in your PR branch again.
I'll rerun the checks.
This PR improves coverage. Thank you!
This was referenced Dec 9, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Add Comprehensive Unit Tests for ThreadPool Module
Bug
Missing test coverage for critical infrastructure component
bittensor/core/threadpool.py(10.5KB). The PriorityThreadPoolExecutor had no dedicated unit tests, leaving critical concurrent task execution infrastructure untested.Description of the Change
This PR adds a comprehensive test suite (
tests/unit_tests/test_threadpool.py) with 35 unit tests covering all aspects of the threadpool module:Test Coverage Added:
Core Functionality (9 tests)
Task Submission & Priority Management (5 tests)
Thread Pool Scaling & Lifecycle (2 tests)
Shutdown Behavior (3 tests)
Error Handling (2 tests)
Initializer Functions (2 tests)
Configuration & Environment (5 tests)
Worker Function Behavior (2 tests)
Edge Cases (5 tests)
Alternate Designs
Alternative approaches considered:
The chosen approach provides thorough unit-level testing while maintaining test independence and fast execution.
Possible Drawbacks
time.sleep()which may be flaky in extremely slow CI environmentsResults:
All tests pass successfully:
Test Categories Verified:
Contribution by Gittensor, learn more at https://gittensor.io/