Repository navigation
Consolidate test fixtures and remove redundant test cases - #126
Merged
Merged
Conversation
- 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
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.
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
no_retry_backoffinconftest.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.make_asr_config()inconftest.py: Provides a factory function for creatingASRConfiginstances with tiny model defaults, reducing boilerplate across test files. Replaces repetitive inline config creation with**overridespattern.unfrozen_encoder_modelintest_asr_modeling.py: Extracts shared model setup for encoder-related tests, improving test isolation and readability.bn_probe_modelintest_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 forcompute_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: RemovedTestComputeEncoderOutputLengthclass testing internal computation logic.test_cli.py: RemovedTestCLIStructureclass with parameterized command accessibility tests.test_handler.py: Removedtest_best_device_prefers_cuda_then_mpstest (device selection logic better tested intest_alignment_device.py).Test Simplification
ASRConfiginstantiations withmake_asr_config()calls throughout test files, improving maintainability when defaults change.DeepgramWordSpec, Deepgram mock factories).pytest.mark.usefixtures("no_retry_backoff")decorator instead of autouse fixtures.projector_configfixture factory in favor of directMockProjectorConfigusage.Implementation Details
no_retry_backofffixture patchestenacity.nap.time.sleepat the module level where tenacity binds it, ensuring all retry decorators skip backoff delays during tests.make_asr_config()uses a sharedTINY_ASR_CONFIG_KWARGSdict to maintain a single source of truth for test model defaults.scope="module") for expensive model creation reduce test runtime while maintaining isolation.https://claude.ai/code/session_01E7xcRLGnemrXeVVYF2qq4L