Repository navigation
test: cover client context manager cleanup - #34
KhushiSharma22 merged 2 commits into
Conversation
Automated advisory review · ClaudeCommit: The supplied patch adds a test file for the Cyberwave context-manager protocol. No production code changes are included, so this review is limited to the test logic itself. One concrete defect is visible in the patch excerpt.
Coverage: 1 of 1 changed files; patch excerpts only. Generated REST code, lockfiles, notebooks, SVGs, missing patches and files beyond the 40-file / 60,000-character budget are excluded. GitHub may truncate individual patches. |
|
Thanks for contributing to the Cyberwave Python SDK, @Bembaby! Maintainer contacts: @KhushiSharma22. When this PR is ready, we request a maintainer review and run an automated advisory review. CI and human review remain the source of truth. Please describe what changed and how you tested it. See the contribution guide or ask for help on Discord. Drafts are welcome. Merged human contributions receive a Discord thank-you. To opt out, check the PR template's Discord opt-out box or add |
|
Thanks for the advisory review. The revised tests mock |
|
Thanks @Bembaby — your contribution has been merged! |
|
Slack team notifications
|
What changed and why?
Closes #29. The SDK's
Cyberwavecontext manager had no direct offline coverage for cleanup on normal or exceptional exit. This adds two tests that check__enter__returns the same client,disconnectis called once on both paths, and an exception raised inside the block propagates. The tests mockdisconnectso they exercise the context-manager contract without initializing MQTT, a backend, or hardware. No SDK behavior or public API changes.How did you test it?
On committed head
04e3a69f97dd64a972181a7fc5bcb6aeec1e933awith Python 3.13.15 and Poetry 2.4.3:poetry run pytest tests/ -q— 3,031 passed, 109 skipped, 1 expected failure.poetry run python tests/test_imports.py— 16/16 passed.poetry run pytest tests/test_client_context_manager.py tests/test_client_twin.py -q— 16 passed.On the original submitted commit, the Windows full suite had 7 failures, 3,024 passes, 109 skips, and 1 expected failure. I ran the same suite on the unchanged base in the same environment: it had the exact same seven failing test IDs and two fewer passes. On that commit,
poetry run mypy cyberwavereported 722 errors in 104 package files, with identical error lines on the unchanged base; this check is not in the current CI workflow. The revised commit was validated with the Linux full suite and Windows focused tests listed above. No live service or robot was used.Contributor checklist
AI assistance
AI assistance was used to prepare and review this test-only contribution and to run the listed checks. Personal human self-review is not claimed.