Skip to content

Commit

Permalink
Add delay to tests to avoid ratelimit
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanC committed Mar 11, 2024
1 parent 6e4d930 commit f1e1e0d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import unittest
from logging import LogRecord
from time import sleep
from typing import Self
from unittest import TestCase

Expand All @@ -25,6 +26,8 @@ def test_emit(self: Self) -> None:
Format: Default
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl)
record: LogRecord | None = None

Expand All @@ -51,6 +54,8 @@ def test_emit_critical_embed(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, embed=True)
record: LogRecord | None = None

Expand Down Expand Up @@ -78,6 +83,8 @@ def test_emit_error_embed(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(
self.webhookUrl, username="Custom Username", embed=True
)
Expand Down Expand Up @@ -108,6 +115,8 @@ def test_emit_warning_embed(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(
self.webhookUrl,
username="Custom Avatar",
Expand Down Expand Up @@ -139,6 +148,8 @@ def test_emit_info_embed(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, embed=True)
record: LogRecord | None = None

Expand All @@ -165,6 +176,8 @@ def test_emit_debug_embed(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, embed=True)
record: LogRecord | None = None

Expand All @@ -191,6 +204,8 @@ def test_emit_embed_long(self: Self) -> None:
Embed: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, embed=True)
record: LogRecord | None = None

Expand Down Expand Up @@ -218,6 +233,8 @@ def test_emit_embed_long_truncate(self: Self) -> None:
Truncate: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, embed=True, truncate=True)
record: LogRecord | None = None

Expand All @@ -243,6 +260,8 @@ def test_emit_long(self: Self) -> None:
Message: Exceeds length limit
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl)
record: LogRecord | None = None

Expand All @@ -269,6 +288,8 @@ def test_emit_long_truncate(self: Self) -> None:
Truncate: Enabled
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, truncate=True)
record: LogRecord | None = None

Expand Down Expand Up @@ -296,6 +317,8 @@ def test_emit_suppressed(self: Self) -> None:
Suppress: ZeroDevisionError
"""

sleep(3)

sink: DiscordSink = DiscordSink(self.webhookUrl, suppress=[ZeroDivisionError])
record: LogRecord | None = None

Expand Down

0 comments on commit f1e1e0d

Please sign in to comment.