Skip to content

Reorganize tests into domain-grouped subdirectories#24

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

Reorganize tests into domain-grouped subdirectories#24
plind-junior wants to merge 4 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.

@plind-junior plind-junior force-pushed the test branch 2 times, most recently from 02607e3 to 11a38cc Compare April 11, 2026 11:45
@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!

plind-junior and others added 2 commits April 17, 2026 03:41
Adds new test files covering axon handlers, chain provider base and
factory, config, logging, misc utilities, metadata, subtensor provider,
and swap poller. Also extends test_bitcoin_signing.py with cases for
to_mainnet_wif, to_mainnet_address, and BitcoinProvider init paths.
@plind-junior plind-junior reopened this Apr 16, 2026
Copy link
Copy Markdown
Collaborator

@LandynDev LandynDev left a comment

Choose a reason for hiding this comment

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

Hey, gave this a pass

  1. drop dupes in test_subtensor.pyTestDecodeCompact and TestIsValidAddress already exist in test_scale.py (landed in #52). delete this please

  2. fix mislabeled tests in TestRejectSynapse
    test_no_context_no_log_error and test_with_context_logs_debug don't assert
    on logging. either rename to match, or patch bt.logging.debug and assert
    the call.

Also, please take another pass with an eye toward trimming. A chunk of these
assertions are exercising stdlib or third-party behavior rather than our code
(keccak determinism, functools.wraps metadata, logging.addLevelName,
argparse defaults, METADATA_DIR.is_dir(), mock-call-counted pass-throughs).

If a test would still pass after deleting our implementation, it's probably
not earning its keep, please cut where that applies.

Just ping when those are in and i'll re-review.

…ak assertions

- test_subtensor.py: remove TestDecodeCompact and TestIsValidAddress (already
  in test_scale.py from entrius#52); keep only TestProviderBasics
- test_axon_handlers.py: TestRejectSynapse — patch bt.logging.debug and
  assert (no_context → not called; with_context → called once with
  '{context}: {reason}'); drop the three keccak property tests that
  exercise pycryptodome rather than our wrapper
- test_misc.py: drop test_preserves_function_metadata (functools.wraps)
  and test_returns_current_block_from_subtensor (mock pass-through)
- test_logging.py: drop test_returns_logger_at_events_level,
  test_registers_event_level_name, test_adds_handler — all just verify
  stdlib logging plumbing we passed through
- test_config.py: drop pure-default argparse tests; keep override tests
  which actually exercise our flag-name + type wiring
- test_metadata.py: deleted (only checks pathlib behavior on a
  Path(__file__).parent constant)

363 tests pass.
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.

2 participants