Skip to content

Clean-up tests, latent code issues, and typos#1677

Open
ZeliardM wants to merge 6 commits intopython-kasa:masterfrom
ZeliardM:feature/test-clean-up
Open

Clean-up tests, latent code issues, and typos#1677
ZeliardM wants to merge 6 commits intopython-kasa:masterfrom
ZeliardM:feature/test-clean-up

Conversation

@ZeliardM
Copy link
Copy Markdown
Contributor

This PR focuses on test cleanup, a few small correctness fixes, and documentation/example updates.

It modernizes the iotbulb.py docstring examples to use the light module API instead of deprecated light shortcut properties, aligns the doctest fixture setup with the updated examples, and tightens deprecation coverage in tests/test_device.py so the deprecated light attributes are still tested intentionally without creating noisy failures. It also narrows the discover raw test to patch the CLI-level redact path, fixes a typo in the changelog, updates the setup action to actions/cache@v5, and adds support for the smart child subtype plug.powerstrip.sub-bulb.

A larger part of the change is explicit resource cleanup across the test suite. Discovery, device config, HTTP client, KLAP, AES, and SSL-AES tests now close sessions, protocols, devices, and transports reliably, including automatic cleanup in the AES and SSL-AES transport tests. This removes the unclosed aiohttp client session warnings from full pytest runs. After these changes the full pytest passes locally; the only remaining warnings are the known fixture completeness warnings.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.25%. Comparing base (be5ce08) to head (a3acfb4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1677      +/-   ##
==========================================
+ Coverage   93.22%   93.25%   +0.03%     
==========================================
  Files         157      157              
  Lines        9815     9815              
  Branches     1003     1003              
==========================================
+ Hits         9150     9153       +3     
+ Misses        472      470       -2     
+ Partials      193      192       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZeliardM
Copy link
Copy Markdown
Contributor Author

@rytilahti This PR cleans up a lot of CI testing warnings and errors, the only thing left now is the handling of the fixture files and incomplete fixture file data warning, which I figured was still useful. Let me know if you have any questions.

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