Skip to content

test: add unit tests for the sync (SyncTranscriber) client#216

Merged
ccampbell-aai merged 2 commits into
masterfrom
ccampbell/add-sync-unit-tests
Jul 24, 2026
Merged

test: add unit tests for the sync (SyncTranscriber) client#216
ccampbell-aai merged 2 commits into
masterfrom
ccampbell/add-sync-unit-tests

Conversation

@ccampbell-aai

Copy link
Copy Markdown
Contributor

What

Adds unit tests for the sync client (assemblyai.sync, SyncTranscriber), which currently has no test coverage in this repo.

  • tests/unit/test_sync.py — request/response behavior: bytes / raw-PCM / WAV input routing, config serialization, X-AAI-Model header, warm() pre-warming, error mapping (SyncTranscriptError), client-side timeout.
  • tests/unit/test_sync_backwards_compat.py — the flat assemblyai.sync / assemblyai.sync_api re-export shims still resolve after the sync/v1 restructure.

Why

These suites lived only in AssemblyAI's internal monorepo, where until now they were the sole automated coverage for the sync client. As SDK development moves to this public repo as the source of truth (the internal copy is being de-vendored and materialized from here at build time), that internal coverage would otherwise disappear. Sync is under active development — keyterms rename, warm(), latency work — so it shouldn't go untested.

Notes

  • Import paths were re-rooted from the internal package path to assemblyai.*; no test logic changed.
  • Uses pytest-httpx (already in tox.ini).
  • Verified locally against the current package: pytest tests/unit/test_sync.py tests/unit/test_sync_backwards_compat.py38 passed.

The sync client (`assemblyai.sync`, `SyncTranscriber`) currently has no test
coverage in this repository. These two suites existed only in AssemblyAI's
internal monorepo, where they were the sole automated coverage for the sync
client. As SDK development moves to this public repo as the source of truth,
they're upstreamed here so sync stays covered — it's under active development
(keyterms rename, `warm()` pre-warming, latency work).

- test_sync.py: request/response behavior (bytes/PCM/WAV input, config
  serialization, model header routing, warm(), error mapping, timeouts).
- test_sync_backwards_compat.py: the flat `assemblyai.sync` / `sync_api`
  re-export shims still resolve after the sync/v1 restructure.

Import paths were re-rooted from the internal package path to `assemblyai.*`.
Verified locally: `pytest tests/unit/test_sync.py
tests/unit/test_sync_backwards_compat.py` → 38 passed.
@ccampbell-aai
ccampbell-aai marked this pull request as ready for review July 23, 2026 15:22

@aurpsis-aai aurpsis-aai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have CI in place to ensure these are run with every PR?

@bgotthold-aai

Copy link
Copy Markdown
Contributor

Do we have CI in place to ensure these are run with every PR?

+1

@ccampbell-aai

Copy link
Copy Markdown
Contributor Author

Yes — they run on every PR. test.yml triggers on pull_requestmaster across Python 3.9–3.12, running toxpytest --cov=assemblyai with no testpaths set, so pytest's default discovery picks up everything under tests/unit/ (these two files included).

Confirmed by the test count on this PR: master runs 334 passed, this branch runs 372 passed — the +38 are exactly these sync tests, green on all four Python versions. So no CI change is needed; discovery gates them automatically.

@ccampbell-aai
ccampbell-aai merged commit 693fbdb into master Jul 24, 2026
7 checks passed
@ccampbell-aai
ccampbell-aai deleted the ccampbell/add-sync-unit-tests branch July 24, 2026 15:17
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.

3 participants