You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running tests with pytest-django, I've encountered an issue where cache data is being shared between test cases, especially when testing throttling logic. This causes tests to fail inconsistently, as the cache state from one test affects another test. I suspect the issue lies in the cache not being properly cleared or isolated between tests.
Steps to Reproduce:
Set up Django views with throttling (e.g., using rest_framework.throttling.ScopedRateThrottle).
Create multiple test cases to test the throttling behavior.
Run the test suite with pytest-django.
Expected behavior:
Each test case should start with a clean cache, and throttling logic should not interfere with other test cases.
Actual behavior:
The cache seems to persist across test cases, causing throttling limits to be applied incorrectly to subsequent tests. This results in tests failing due to unexpected throttling responses.
It seems that the cache is not being cleared or reset between tests, which leads to throttling rules being incorrectly applied to test cases that should otherwise pass.
Possible Solution:
A potential solution might be to ensure that the cache is explicitly cleared or isolated between test cases, possibly by adding an automatic cache reset between tests or providing guidance on how to properly configure cache isolation in pytest-django.
The text was updated successfully, but these errors were encountered:
When running tests with pytest-django, I've encountered an issue where cache data is being shared between test cases, especially when testing throttling logic. This causes tests to fail inconsistently, as the cache state from one test affects another test. I suspect the issue lies in the cache not being properly cleared or isolated between tests.
Steps to Reproduce:
Set up Django views with throttling (e.g., using rest_framework.throttling.ScopedRateThrottle).
Create multiple test cases to test the throttling behavior.
Run the test suite with pytest-django.
Expected behavior:
Each test case should start with a clean cache, and throttling logic should not interfere with other test cases.
Actual behavior:
The cache seems to persist across test cases, causing throttling limits to be applied incorrectly to subsequent tests. This results in tests failing due to unexpected throttling responses.
It seems that the cache is not being cleared or reset between tests, which leads to throttling rules being incorrectly applied to test cases that should otherwise pass.
Possible Solution:
A potential solution might be to ensure that the cache is explicitly cleared or isolated between test cases, possibly by adding an automatic cache reset between tests or providing guidance on how to properly configure cache isolation in pytest-django.
The text was updated successfully, but these errors were encountered: