Skip to content

[codex] Isolate phone call router test imports#7937

Open
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-phone-calls-redis-stub
Open

[codex] Isolate phone call router test imports#7937
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-phone-calls-redis-stub

Conversation

@tianmind-studio

Copy link
Copy Markdown
Contributor

Summary

  • Stub the phone-call router's database, quota, auth, and lightweight form-parser import surfaces inside test_phone_calls.py.
  • Keep the test focused on the phone router behavior without requiring Firestore, Redis/BYOK, or python-multipart in a lightweight Windows unit-test venv.
  • Preserve real utils / database package paths so real modules such as utils.twilio_service can still import when needed.

Root cause

test_phone_calls.py already stubs Twilio and Firebase, but importing routers.phone_calls still pulled in real database/quota/auth dependencies. On this Windows lightweight backend venv, standalone collection failed before any phone-call assertion ran:

  • python -m pytest backend\tests\unit\test_phone_calls.py --collect-only -q --tb=short -> ImportError: cannot import name 'firestore' from 'google.cloud'

After the import stubs, the TwiML tests advanced to Starlette form parsing, where the same lightweight venv lacked python-multipart. The test only sends URL-encoded fields, so this PR provides the minimum parser surface Starlette needs for those requests.

Validation

  • python -m pytest backend\tests\unit\test_phone_calls.py --collect-only -q --tb=short -> 18 tests collected
  • python -m pytest backend\tests\unit\test_phone_calls.py -q --tb=short -> 18 passed, 1 warning
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_phone_calls.py -q --tb=short -> 44 passed, 1 warning
  • python -m black --check --line-length 120 --skip-string-normalization backend\tests\unit\test_phone_calls.py
  • python -m py_compile backend\tests\unit\test_phone_calls.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