Skip to content

Consolidate test fixtures and remove redundant test cases - #126

Merged
alexkroman merged 1 commit into
mainfrom
claude/clever-turing-8ggbws
Oct 8, 2026
Merged

alexkroman merged 1 commit into
mainfrom
claude/clever-turing-8ggbws

Conversation

@alexkroman

Copy link
Copy Markdown
Owner

Summary

This PR consolidates test infrastructure by extracting common fixture patterns into reusable utilities and removes redundant test cases that duplicate coverage or test implementation details rather than behavior.

Key Changes

Test Infrastructure Consolidation

  • New shared fixture no_retry_backoff in conftest.py: Centralizes the tenacity sleep-skipping logic used across multiple test files (test_scripts_eval.py, test_eval_smallest.py, test_scripts_deploy.py). This eliminates code duplication and makes retry tests consistently fast.
  • New helper function make_asr_config() in conftest.py: Provides a factory function for creating ASRConfig instances with tiny model defaults, reducing boilerplate across test files. Replaces repetitive inline config creation with **overrides pattern.
  • New fixture unfrozen_encoder_model in test_asr_modeling.py: Extracts shared model setup for encoder-related tests, improving test isolation and readability.
  • New fixture bn_probe_model in test_encoder_partial_unfreeze.py: Consolidates BatchNorm probe model creation used across multiple test methods.

Removed Redundant Tests

  • test_scripts_eval.py: Removed entire test classes (TestDatasetConfig, TestDatasetRegistry, TestEvalResult, TestEvaluatorBase) that tested internal dataclass/base class behavior rather than public API contracts. These are better covered by integration tests.
  • test_asr_config.py: Removed tests for compute_encoder_output_length() function (moved to dedicated test file or removed as implementation detail).
  • test_normalize_label.py: Removed tests for punctuation tag handling and percent canonicalization that were testing legacy behavior no longer in the normalizer.
  • test_label_normalization.py: Consolidated marker stripping tests into parameterized test cases, removing redundant individual test methods.
  • test_asr_processing.py: Removed TestComputeEncoderOutputLength class testing internal computation logic.
  • test_cli.py: Removed TestCLIStructure class with parameterized command accessibility tests.
  • test_handler.py: Removed test_best_device_prefers_cuda_then_mps test (device selection logic better tested in test_alignment_device.py).

Test Simplification

  • Replaced inline ASRConfig instantiations with make_asr_config() calls throughout test files, improving maintainability when defaults change.
  • Removed unused imports and TypedDict definitions (DeepgramWordSpec, Deepgram mock factories).
  • Simplified fixture setup by using pytest.mark.usefixtures("no_retry_backoff") decorator instead of autouse fixtures.
  • Removed projector_config fixture factory in favor of direct MockProjectorConfig usage.

Implementation Details

  • The no_retry_backoff fixture patches tenacity.nap.time.sleep at the module level where tenacity binds it, ensuring all retry decorators skip backoff delays during tests.
  • make_asr_config() uses a shared TINY_ASR_CONFIG_KWARGS dict to maintain a single source of truth for test model defaults.
  • Fixture scope adjustments (scope="module") for expensive model creation reduce test runtime while maintaining isolation.

https://claude.ai/code/session_01E7xcRLGnemrXeVVYF2qq4L

- conftest: remove unused Deepgram mock factories and projector_config
  fixture; add make_asr_config() so the tiny-model ASRConfig kwargs live in
  one place; add an opt-in no_retry_backoff fixture replacing three copies
  of the tenacity sleep patch.
- Delete tests duplicated elsewhere (scripts_eval vs eval_base/datasets,
  asr_config vs asr_config_helpers, normalize_label vs label_normalization,
  TestCLIStructure, handler device ordering) and the processor tests that
  checked a hand-copied formula instead of product code.
- Share expensive models where tests only read them, read a dataset
  column without decoding audio, and module-scope collator tokenizer and
  feature-extractor fixtures. Full suite ~124s -> ~75s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E7xcRLGnemrXeVVYF2qq4L
@alexkroman
alexkroman merged commit d383a1b into main Oct 8, 2026
2 checks passed
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