Skip to content

[codex] Isolate sync decode test imports on Windows#7948

Open
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-sync-decode-test-stubs
Open

[codex] Isolate sync decode test imports on Windows#7948
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-sync-decode-test-stubs

Conversation

@tianmind-studio

Copy link
Copy Markdown
Contributor

Summary

  • Add a temporary python_multipart stub while importing routers.sync in the PCM and Opus decode unit tests, so lightweight Windows backend envs can collect the tests without the full multipart package installed.
  • Ensure the tests' existing import-time stubs expose the full routers.sync import surface, even when earlier-collected tests left partial modules in sys.modules.
  • Keep the changes scoped to test isolation; production sync decode code is unchanged.

Root cause

These decode tests exercise pure PCM/Opus WAL conversion helpers, but importing routers.sync also builds FastAPI routes and imports optional service helpers. In this Windows lightweight backend venv, standalone collection failed on FastAPI's multipart package check. In collection-order runs after stub-heavy tests, partial opuslib, database.conversations, utils.cloud_tasks, and utils.other.endpoints modules could block collection before the decode assertions ran.

Before this change:

  • python -m pytest backend\tests\unit\test_sync_pcm_decode.py --collect-only -q --tb=short -> RuntimeError: Form data requires "python-multipart" to be installed.
  • python -m pytest backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short -> RuntimeError: Form data requires "python-multipart" to be installed.
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short --continue-on-collection-errors -> import failures from partial sync dependencies.

Validation

  • python -m pytest backend\tests\unit\test_sync_pcm_decode.py --collect-only -q --tb=short -> 23 tests collected
  • python -m pytest backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short -> 21 tests collected
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short --continue-on-collection-errors -> 70 tests collected
  • python -m pytest backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py -q --tb=short -> 44 passed
  • python -m pytest backend\tests\unit\test_sync_opus_decode.py backend\tests\unit\test_sync_pcm_decode.py -q --tb=short -> 44 passed
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py -q --tb=short -> 70 passed
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_sync_opus_decode.py backend\tests\unit\test_sync_pcm_decode.py -q --tb=short -> 70 passed
  • python -m pytest backend\tests\unit --collect-only -q --tb=short --continue-on-collection-errors -> still exits 1 from existing unrelated collection errors, but both sync decode files collect and no longer appear in the error summary
  • python -m black --line-length 120 --skip-string-normalization backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
  • python -m py_compile backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
  • git diff --check
  • scripts\pre-commit

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