pytest-dev / pytest-dev/pytest-django
Impossible to bypass THROTTLE - Django REST
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the autouse bypass_throttle fixture with live_server, then inspect how the project and Django REST Framework load throttle settings during tests. Done means identifying a reliable way to disable throttling for most test cases while preserving tests that explicitly exercise throttling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100