@@ -545,24 +545,21 @@ def test_missing_discord_log_channel_webhook_url(self) -> None:
545545 """Test that no error occurs when no `DISCORD_LOG_CHANNEL_WEBHOOK_URL` is provided."""
546546 RuntimeSettings : Final [type [Settings ]] = config ._settings_class_factory ()
547547
548- with (
549- EnvVariableDeleter ("DISCORD_LOG_CHANNEL_WEBHOOK_URL" ),
550- pytest .raises (
551- expected_exception = ImproperlyConfiguredError ,
552- match = (
553- "DISCORD_LOG_CHANNEL_WEBHOOK_URL must be a valid webhook URL "
554- "that points to a discord channel where logs should be displayed."
555- ),
556- ),
557- ):
558- RuntimeSettings ._setup_discord_log_channel_webhook ()
548+ with EnvVariableDeleter ("DISCORD_LOG_CHANNEL_WEBHOOK_URL" ), EnvVariableDeleter ("DISCORD_BOT_TOKEN" ):
549+ try :
550+ RuntimeSettings ._setup_discord_log_channel_webhook ()
551+ except ImproperlyConfiguredError :
552+ pytest .fail (reason = "ImproperlyConfiguredError was raised" , pytrace = False )
553+
554+ RuntimeSettings ._is_env_variables_setup = True
555+
556+ assert not RuntimeSettings ()["DISCORD_LOG_CHANNEL_WEBHOOK_URL" ]
557+
559558
560559 @pytest .mark .parametrize (
561560 "invalid_discord_log_channel_url" ,
562561 (
563562 "invalid_discord_log_channel_url" ,
564- "" ,
565- " " ,
566563 re .sub (
567564 r"/\d{17,20}/" ,
568565 (
@@ -582,7 +579,7 @@ def test_missing_discord_log_channel_webhook_url(self) -> None:
582579 count = 1 ,
583580 ),
584581 ),
585- ids = [f"case_{ i } " for i in range (5 )],
582+ ids = [f"case_{ i } " for i in range (3 )],
586583 )
587584 def test_invalid_discord_log_channel_webhook_url (
588585 self ,
@@ -2202,7 +2199,7 @@ def test_too_short_send_get_roles_reminders_delay(
22022199 ) -> None :
22032200 """Test that an error is thrown if `SEND_GET_ROLES_REMINDERS_DELAY` is too short."""
22042201 TOO_SMALL_SEND_GET_ROLES_REMINDERS_DELAY_MESSAGE : Final [str ] = (
2205- "SEND_SEND_GET_ROLES_REMINDERS_DELAY must be longer than or equal to 1 day."
2202+ "SEND_GET_ROLES_REMINDERS_DELAY must be longer than or equal to 1 day."
22062203 )
22072204
22082205 RuntimeSettings : Final [type [Settings ]] = config ._settings_class_factory ()
0 commit comments