Skip to content

test(voice_processing): test_get_speech_provider_convenience depends on import-order side effect, fails standalone #13005

Description

@mrveiss

What

Discovered while verifying issue #12979 batch 9 (unrelated scope — this test does not exercise any converted code path). Confirmed pre-existing via cp-swap of voice_processing/providers/lv/tilde_provider.py against origin/Dev_new_gui — identical failure with the unmodified file.

autobot-backend/voice_processing/providers/test_registry.py::TestGlobalRegistry::test_get_speech_provider_convenience fails when the file is run standalone (or as part of a smaller subset that doesn't happen to import the module that populates the global registry first):

FAILED voice_processing/providers/test_registry.py::TestGlobalRegistry::test_get_speech_provider_convenience
AssertionError: assert None is not None
WARNING  voice_processing.providers:__init__.py:100 No provider registered for language: lv

Root cause

voice_processing/providers/test_registry.py:229-237:

def test_get_speech_provider_convenience(self):
    """Test convenience function get_speech_provider."""
    # This will return provider from the global registry
    # which should have providers registered via registry_init
    provider = get_speech_provider("lv")
    # After registry_init, we should have providers for 'lv'
    # Note: This test assumes registry_init has been imported
    assert provider is not None

The test's own comment admits it "assumes registry_init has been imported" elsewhere in the process — i.e. it relies on import-order side effects from another test module having already populated the process-global speech-provider registry singleton. When this file runs alone (pytest voice_processing/providers/test_registry.py), nothing has imported the module that registers the lv provider, so get_speech_provider("lv") returns None and the test fails.

Evidence

$ python3 -m pytest autobot-backend/voice_processing/providers/test_registry.py -q
1 failed, 13 passed in 0.99s

Same single failure reproduces against origin/Dev_new_gui's unmodified tilde_provider.py (cp-swap baseline, no diff) — confirming the failure is unrelated to any HTTP-client change.

Suggested fix

Add an explicit fixture (e.g. import voice_processing.registry_init or call whatever registers the default providers) at the top of the test, or in a module/session-scoped autouse fixture, so the test does not depend on other test modules having run first in the same process.

Model Used

Sonnet (claude-sonnet-5)

Activity

  1. modified the milestones: Backlog, v0.15.0 on Sep 12, 2026
  2. mrveiss commented on Oct 4, 2026

    @mrveiss
    OwnerAuthor

    Closing — the prescribed fix is in merged main, verified independently at baec13de40.

    This issue carries no acceptance-criteria checklist; its bar is the Suggested fix, which was to add an explicit import so the test does not depend on another module having been imported first. Landed:

    autobot-backend/voice_processing/providers/test_registry.py:39

    from voice_processing.providers import registry_init  # noqa: F401  isort:skip
    

    with the rationale recorded at :32-38 — "importing it here is what makes the global-registry assertion below measure the real thing instead of an empty dict". The test body at :238-245 is unchanged, so the assertion is the same one; only its precondition is now explicit.

    Stated limit: the cause named in this issue is removed in merged code, which is what I verified. I did not re-run the test standalone to confirm the behavioural claim — this was a read-only verification pass. If you want that confirmed, the python-suite verdict for that file on any recent green run settles it.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions