test: port session and video tests off sync io#851
Conversation
Replace the sync path.write_bytes, read_bytes, exists, write_text and read_text calls in the session and CSRF tests with aiofiles based helpers (async_write_bytes etc., new in conftest), and route the PyAV-based video validation in test_get_camera_video through asyncio.to_thread, so the autouse blockbuster fixture no longer has to xfail any of them; the _KNOWN_BLOCKING list is now empty.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR migrates the test suite from synchronous blocking file I/O to non-blocking async file operations. New async helper functions are introduced in conftest, a blocker xfail list is cleared, and all file I/O calls in test_api and test_utils are updated to use awaited async operations. ChangesAsync File I/O Migration for Test Suite
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Description of change
Drains the
_KNOWN_BLOCKINGxfail list from the blockbuster PR by porting the 17 remaining tests off sync IO. The session and CSRF tests intests/test_api.pynow write and read their config files via smallasync_write_bytes/async_read_bytes/async_write_text/async_read_texthelpers added totests/conftest.py(thin aiofiles wrappers), andpath.existschecks switch toaiofiles.os.path.exists;test_get_camera_videoswaps theNamedTemporaryFilewrite foraiofilesinto atmp_pathand runs the PyAV validate throughasyncio.to_thread;test_write_jsonfollows the same pattern.After this
_KNOWN_BLOCKINGis empty, the autouse blockbuster fixture passes for the whole suite, andpre-commit run -ais clean.Pull-Request Checklist
mainbranchFixes #0000N/Amain).Summary by CodeRabbit