Replies: 1 comment
|
a few approaches that work well:
from slowapi import _rate_limit_exceeded_handler limiter.enabled = False # add this in your conftest.py or test setup
import pytest @pytest.fixture(autouse=True)
@pytest.fixture
from unittest.mock import MagicMock def test_something(client): the limiter.enabled = False approach is cleanest for most cases. just make sure to set it back in teardown if running tests in parallel. |
Uh oh!
There was an error while loading. Please reload this page.
What's the recommended way to disable/mock rate limiting in pytest tests while keeping the decorators in production code?
All reactions