Skip to content

Reorganize tests into domain-grouped subdirectories#24

Open
plind-junior wants to merge 3 commits intoentrius:testfrom
plind-junior:test
Open

Reorganize tests into domain-grouped subdirectories#24
plind-junior wants to merge 3 commits intoentrius:testfrom
plind-junior:test

Conversation

@plind-junior
Copy link
Copy Markdown

@plind-junior plind-junior commented Apr 8, 2026

Summary

  • Restructures flat tests/ layout into subdirectories mirroring the source tree (core/, contract/, chain_providers/, validator/, miner/)
  • Splits test_scale.py into contract/test_scale.py and chain_providers/test_subtensor.py by concern
  • Extracts shared make_swap / make_confirmed_tx factories into tests/helpers.py, eliminating duplication across modules
  • Adds pytest-cov with term-missing and HTML report targets; coverage baseline is 43%

Test plan

  • uv run pytest — all 280 tests pass
  • Coverage report generates without error

@plind-junior
Copy link
Copy Markdown
Author

plind-junior commented Apr 8, 2026

Hey @LandynDev @anderdc , could you take a look at this when you get a chance? No functional changes — purely test infrastructure. The main things to verify are that the subdirectory layout makes sense to you and that the helpers.py factory pattern is the right abstraction for shared fixtures. Happy to adjust the structure if you prefer something different.

Restructure the flat tests/ layout into subdirectories that mirror the
source tree (core/, contract/, chain_providers/, validator/, miner/).
Split the mixed test_scale.py into contract/test_scale.py and
chain_providers/test_subtensor.py. Extract shared swap and transaction
fixtures into tests/helpers.py to eliminate duplication across modules.
Add pytest-cov with term-missing and HTML report targets.
Add unit tests for previously uncovered modules:
- SwapPoller incremental scan, cursor management, mark_processed
- SwapTracker initialize, poll, prune_window, query helpers, _resolved_block
- apply_recycle: emission vs fee scaling, recycle_uid accumulation, edge cases
- commitments: decode_commitment_field, get_commitment, read_miner_commitment, read_miner_commitments
- create_chain_providers: registry forwarding, check/require_send flags, failure handling
- utils.misc: ttl_cache, _ttl_hash_gen, ttl_get_block
- utils.logging: setup_events_logger, log_on_change dedup behaviour

Extend existing suites for previously missed branches in fulfillment
(non-TAO dest commitment lookup, save exception path) and
pending_confirms (remove-nonexistent, closed-connection guard).

Coverage: 43% → 55% (389 tests, +109 tests)
@plind-junior
Copy link
Copy Markdown
Author

Hi @LandynDev, when you have a moment, could you please review my PR? No rush — just wanted to bring it to your attention. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant