mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
test-backend: Remove rate_limiter from not_yet_fully_covered.
rate_limiter.py now has sufficient test coverage to remove from the list of exclusions. Tweaked by tabbott to handle @abstractmethod in a better way.
This commit is contained in:
committed by
Tim Abbott
parent
5f9da3053d
commit
fbc8325d0e
@@ -15,6 +15,8 @@ exclude_lines =
|
|||||||
raise UnexpectedWebhookEventType
|
raise UnexpectedWebhookEventType
|
||||||
# Don't require coverage for blocks only run when type-checking
|
# Don't require coverage for blocks only run when type-checking
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
# Don't require coverage for abstract methods; they're never called.
|
||||||
|
@abstractmethod
|
||||||
# Don't require coverage for the settings.LOG_API_EVENT_TYPES code paths
|
# Don't require coverage for the settings.LOG_API_EVENT_TYPES code paths
|
||||||
# These are only run in a special testing mode, so will fail normal coverage.
|
# These are only run in a special testing mode, so will fail normal coverage.
|
||||||
if settings.LOG_API_EVENT_TYPES:
|
if settings.LOG_API_EVENT_TYPES:
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ not_yet_fully_covered = {path for target in [
|
|||||||
'zerver/lib/parallel.py',
|
'zerver/lib/parallel.py',
|
||||||
'zerver/lib/profile.py',
|
'zerver/lib/profile.py',
|
||||||
'zerver/lib/queue.py',
|
'zerver/lib/queue.py',
|
||||||
'zerver/lib/rate_limiter.py',
|
|
||||||
'zerver/lib/sqlalchemy_utils.py',
|
'zerver/lib/sqlalchemy_utils.py',
|
||||||
'zerver/lib/storage.py',
|
'zerver/lib/storage.py',
|
||||||
'zerver/lib/stream_recipient.py',
|
'zerver/lib/stream_recipient.py',
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class RedisRateLimiterBackend(RateLimiterBackend):
|
|||||||
|
|
||||||
if key_blocked is not None:
|
if key_blocked is not None:
|
||||||
# We are manually blocked. Report for how much longer we will be
|
# We are manually blocked. Report for how much longer we will be
|
||||||
if blocking_ttl_b is None:
|
if blocking_ttl_b is None: # nocoverage # defensive code, this should never happen
|
||||||
blocking_ttl = 0.5
|
blocking_ttl = 0.5
|
||||||
else:
|
else:
|
||||||
blocking_ttl = int(blocking_ttl_b)
|
blocking_ttl = int(blocking_ttl_b)
|
||||||
@@ -436,7 +436,7 @@ class RedisRateLimiterBackend(RateLimiterBackend):
|
|||||||
|
|
||||||
# If no exception was raised in the execution, there were no transaction conflicts
|
# If no exception was raised in the execution, there were no transaction conflicts
|
||||||
break
|
break
|
||||||
except redis.WatchError:
|
except redis.WatchError: # nocoverage # Ideally we'd have a test for this.
|
||||||
if count > 10:
|
if count > 10:
|
||||||
raise RateLimiterLockingException()
|
raise RateLimiterLockingException()
|
||||||
count += 1
|
count += 1
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class RateLimiterBackendBase(ZulipTestCase):
|
|||||||
"""
|
"""
|
||||||
This depends on the algorithm used in the backend, and should be defined by the test class.
|
This depends on the algorithm used in the backend, and should be defined by the test class.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError # nocoverage
|
raise NotImplementedError()
|
||||||
|
|
||||||
def test_hit_ratelimits(self) -> None:
|
def test_hit_ratelimits(self) -> None:
|
||||||
obj = self.create_object('test', [(2, 3), ])
|
obj = self.create_object('test', [(2, 3), ])
|
||||||
|
|||||||
Reference in New Issue
Block a user