mirror of https://github.com/zulip/zulip.git
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:
parent
5f9da3053d
commit
fbc8325d0e
|
@ -15,6 +15,8 @@ exclude_lines =
|
|||
raise UnexpectedWebhookEventType
|
||||
# Don't require coverage for blocks only run when 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
|
||||
# These are only run in a special testing mode, so will fail normal coverage.
|
||||
if settings.LOG_API_EVENT_TYPES:
|
||||
|
|
|
@ -93,7 +93,6 @@ not_yet_fully_covered = {path for target in [
|
|||
'zerver/lib/parallel.py',
|
||||
'zerver/lib/profile.py',
|
||||
'zerver/lib/queue.py',
|
||||
'zerver/lib/rate_limiter.py',
|
||||
'zerver/lib/sqlalchemy_utils.py',
|
||||
'zerver/lib/storage.py',
|
||||
'zerver/lib/stream_recipient.py',
|
||||
|
|
|
@ -369,7 +369,7 @@ class RedisRateLimiterBackend(RateLimiterBackend):
|
|||
|
||||
if key_blocked is not None:
|
||||
# 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
|
||||
else:
|
||||
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
|
||||
break
|
||||
except redis.WatchError:
|
||||
except redis.WatchError: # nocoverage # Ideally we'd have a test for this.
|
||||
if count > 10:
|
||||
raise RateLimiterLockingException()
|
||||
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.
|
||||
"""
|
||||
raise NotImplementedError # nocoverage
|
||||
raise NotImplementedError()
|
||||
|
||||
def test_hit_ratelimits(self) -> None:
|
||||
obj = self.create_object('test', [(2, 3), ])
|
||||
|
|
Loading…
Reference in New Issue