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

@tianmind-studio tianmind-studio commented Jun 14, 2026

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.

Refresh

  • Rebased on main at 9ed12aea07.
  • Current head: 76cbab4b33.

Validation

  • python -m pytest backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short -> 44 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 --collect-only -q --tb=short --continue-on-collection-errors -> 70 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 -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 py_compile backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
  • python -m black --line-length 120 --skip-string-normalization --check backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
  • git diff --check origin/main...HEAD
  • scripts/pre-commit

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Test-only stabilization (import isolation / stubs); zero product risk, CI not failing.

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