pytest-eventlet is a pytest plugin that automatically applies the eventlet monkey-patch to your test suite. It simplifies testing eventlet-dependent code by ensuring the environment is correctly configured. The current version is 1.0.0, and as an initial release, its cadence is currently low but stable.
pip install pytest-eventlet eventletNo compatibility data collected yet for this library.
Create a file named `test_eventlet_patch.py`. With `pytest-eventlet` and `eventlet` installed, simply running `pytest` will automatically apply the monkey-patch. This quickstart test verifies that the `socket` module has indeed been patched by `eventlet`.
Ensure `eventlet` is installed: `pip install pytest-eventlet eventlet`.
Isolate test runs by using separate virtual environments or explicitly disabling conflicting plugins. For `pytest-eventlet`, you can use the `--no-eventlet` flag to temporarily disable its patching.
Remove `--no-eventlet` from your pytest command if you intend for eventlet patching to be active.
Install the `eventlet` library: `pip install eventlet`.
Verify `eventlet` is installed. Ensure `pytest-eventlet` is in your environment and not disabled by a pytest config or command-line flag like `--no-eventlet`.
Confirm `eventlet` patching is active using a diagnostic test (like the quickstart example). Review your application code for blocking operations that need to be made cooperative with `eventlet`.