What pyleak does
pyleak is a pytest plugin that automatically detects event loop blocking in your asyncio test suite. It catches synchronous calls that freeze the event loop (like time.sleep(), requests.get(), or CPU-intensive operations) and provides detailed stack traces showing exactly where the blocking occurs. Zero configuration required – just install and run your tests.
The problem it solves
Event loop blocking is the silent killer of async performance. A single time.sleep(0.1) in an async function can tank your entire application’s throughput, but these issues hide during development and only surface under production load. Traditional testing can’t detect these problems because the tests still pass – they just run slower than they should.
Target audience
This is a pytest-plugin for Python developers building asyncio applications. It’s particularly valuable for teams shipping async web services, AI agent frameworks, real-time applications, and concurrent data processors where blocking calls can destroy performance under load but are impossible to catch reliably during development.
pip install pytest-pyleak import pytest @pytest.mark.no_leak async def test_my_application(): …
PyPI: pip install pyleak
submitted by /u/deepankarmh to r/Python
[link] [comments]
Laisser un commentaire