pytest-dev/pytest-django

Impossible to bypass THROTTLE - Django REST

Pithikos opened this issue · 0 comments

I'm trying to test throttling in some test cases with live_server and it's a pain in the butt.

After spending way too much time trying to override LiveServer I figured it might be simpler to just disable throttling for most test cases with an autouse fixture like below.

@pytest.fixture(autouse=True)
def bypass_throttle(settings):
    settings.REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"] = []
    settings.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = {}
    yield

However this again has no effect. Is there any reliable way to do this?