From db126a0c00e1ae6dc1fd50eb154a216b9d257ed9 Mon Sep 17 00:00:00 2001 From: "sveeraraghavan@FRLPMC3060" Date: Mon, 29 Jun 2026 11:48:59 +0200 Subject: [PATCH] Standardise the grammar to British english --- README.md | 4 +- prod-config.toml | 14 +-- scripts/configure-guild.py | 24 ++--- src/europython_discord/bot.py | 8 +- .../__init__.py | 0 .../cog.py | 24 ++--- .../config.py | 2 +- .../livestream_connector.py | 0 .../models.py | 0 .../programme_connector.py} | 6 +- .../session_to_embed.py | 2 +- src/europython_discord/registration/cog.py | 2 +- test-config.toml | 14 +-- .../test_program_connector.py | 90 +++++++++---------- .../test_session_to_embed.py | 6 +- 15 files changed, 98 insertions(+), 98 deletions(-) rename src/europython_discord/{program_notifications => programme_notifications}/__init__.py (100%) rename src/europython_discord/{program_notifications => programme_notifications}/cog.py (85%) rename src/europython_discord/{program_notifications => programme_notifications}/config.py (89%) rename src/europython_discord/{program_notifications => programme_notifications}/livestream_connector.py (100%) rename src/europython_discord/{program_notifications => programme_notifications}/models.py (100%) rename src/europython_discord/{program_notifications/program_connector.py => programme_notifications/programme_connector.py} (95%) rename src/europython_discord/{program_notifications => programme_notifications}/session_to_embed.py (98%) diff --git a/README.md b/README.md index 57f080e0..0d442542 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The scripts work standalone and only require an Auth token. Please find more doc The bot has the following extensions ("Cogs"): * Ping: To check if the bot is running, write `$ping` in any channel. The bot will respond with `Pong!`. -* Guild Statistics: As an organizer, write `$participants` in an organizer-only channel. The bot will respond with a list of roles, and the number of members per role. +* Guild Statistics: As an organiser, write `$participants` in an organiser-only channel. The bot will respond with a list of roles, and the number of members per role. * Registration: On startup, the bot posts a registration form. New users must register using their Pretix ticket data. On success, the bot assigns the appropriate roles. * Programme Notifications: Before each session, the bot posts a session summary and updates the livestream URLs. @@ -193,4 +193,4 @@ Related files: * `/root/livestreams.toml`: Livestream URL configuration * `/home/bot/registered_log.txt`: Registration log * `/home/bot/pretix_cache.json`: Pretix cache - * `/home/bot/schedule_cache.json`: Program cache + * `/home/bot/schedule_cache.json`: Programme cache diff --git a/prod-config.toml b/prod-config.toml index fc331c77..aa9cf084 100644 --- a/prod-config.toml +++ b/prod-config.toml @@ -37,23 +37,23 @@ pretix_cache_file = "pretix_cache.json" "Beginners’ Day Unconference / Humble Data Access" = ["Beginners Day"] [registration.variation_to_roles] -# organizers -"Volunteer" = ["Organizers", "Volunteers", "Onsite Volunteers"] +# organisers +"Volunteer" = ["Organisers", "Volunteers", "Onsite Volunteers"] -[program_notifications] +[programme_notifications] api_url = "https://static.europython.eu/programme/ep2026/releases/current/schedule.json" schedule_cache_file = "schedule_cache.json" livestream_url_file = "livestreams.toml" main_notification_channel_name = "programme-notifications" -# optional simulated start time for testing program notifications +# optional simulated start time for testing programme notifications # simulated_start_time = "2026-07-15T08:50:00+02:00" -# optional fast mode for faster testing of program notifications +# optional fast mode for faster testing of programme notifications # will only take effect if simulated_start_time is set # fast_mode = true -[program_notifications.rooms_to_channel_names] +[programme_notifications.rooms_to_channel_names] "S1" = "s1" "S2" = "s2" "S3A" = "s3a" @@ -62,7 +62,7 @@ main_notification_channel_name = "programme-notifications" "Exhibit Hall" = "exhibit-hall" [guild_statistics] -required_role = "Organizers" +required_role = "Organisers" [dog] channel_name = "animal-appreciation" diff --git a/scripts/configure-guild.py b/scripts/configure-guild.py index 3d06d714..597e8368 100644 --- a/scripts/configure-guild.py +++ b/scripts/configure-guild.py @@ -238,7 +238,7 @@ def verify_permission_roles(self) -> Self: ROLE_COC = "Code of Conduct Committee" ROLE_MODERATORS = "Moderators" -ROLE_ORGANIZERS = "Organizers" +ROLE_ORGANISERS = "Organisers" ROLE_VOLUNTEERS = "Volunteers" ROLE_SPEAKERS = "Speakers" ROLE_SPONSORS = "Sponsors" @@ -248,10 +248,10 @@ def verify_permission_roles(self) -> Self: ROLES_COC = [ROLE_COC] ROLES_MODERATORS = [ROLE_MODERATORS, *ROLES_COC] -ROLES_ORGANIZERS = [ROLE_ORGANIZERS, *ROLES_MODERATORS] -ROLES_VOLUNTEERS = [ROLE_VOLUNTEERS, *ROLES_ORGANIZERS] -ROLES_SPEAKERS = [ROLE_SPEAKERS, *ROLES_ORGANIZERS] -ROLES_SPONSORS = [ROLE_SPONSORS, *ROLES_ORGANIZERS] +ROLES_ORGANISERS = [ROLE_ORGANISERS, *ROLES_MODERATORS] +ROLES_VOLUNTEERS = [ROLE_VOLUNTEERS, *ROLES_ORGANISERS] +ROLES_SPEAKERS = [ROLE_SPEAKERS, *ROLES_ORGANISERS] +ROLES_SPONSORS = [ROLE_SPONSORS, *ROLES_ORGANISERS] ROLES_REGISTERED = [ ROLE_PARTICIPANTS, ROLE_SPONSORS, @@ -291,7 +291,7 @@ def verify_permission_roles(self) -> Self: ], ), Role( - name=ROLE_ORGANIZERS, + name=ROLE_ORGANISERS, color=COLOR_DARK_YELLOW, permissions=["mention_everyone", "use_external_apps", "manage_roles"], ), @@ -474,7 +474,7 @@ def verify_permission_roles(self) -> Self: PermissionOverwrite( roles=[ROLE_EVERYONE], deny=["send_messages", "create_public_threads"] ), - PermissionOverwrite(roles=[ROLE_ORGANIZERS], allow=["send_messages"]), + PermissionOverwrite(roles=[ROLE_ORGANISERS], allow=["send_messages"]), ], ), TextChannel( @@ -487,9 +487,9 @@ def verify_permission_roles(self) -> Self: ForumChannel( name="support", topic=""" - Use this forum channel to create support tickets if you **need support from the conference organization**. Please don't open forum threads related to other topics, as that makes it difficult for the organizers to keep track of support tickets that need their attention. + Use this forum channel to create support tickets if you **need support from the conference organization**. Please don't open forum threads related to other topics, as that makes it difficult for the organisers to keep track of support tickets that need their attention. - If you to make a report to the Code of Conduct Committee, please use coc@europython.eu or contact an organizer at the conference. + If you to make a report to the Code of Conduct Committee, please use coc@europython.eu or contact an organiser at the conference. """, # noqa: E501 (line too long) tags=["Remote Support", "On-Site Support"], require_tag=True, @@ -756,7 +756,7 @@ def verify_permission_roles(self) -> Self: roles=[ROLE_EVERYONE], deny=["send_messages", "create_public_threads"] ), PermissionOverwrite(roles=ROLES_REGISTERED, deny=["view_channel"]), - PermissionOverwrite(roles=ROLES_ORGANIZERS, allow=["view_channel"]), + PermissionOverwrite(roles=ROLES_ORGANISERS, allow=["view_channel"]), ], ), TextChannel( @@ -767,7 +767,7 @@ def verify_permission_roles(self) -> Self: roles=[ROLE_EVERYONE], deny=["send_messages", "create_public_threads"] ), PermissionOverwrite(roles=ROLES_REGISTERED, deny=["view_channel"]), - PermissionOverwrite(roles=ROLES_ORGANIZERS, allow=["view_channel"]), + PermissionOverwrite(roles=ROLES_ORGANISERS, allow=["view_channel"]), ], ), ForumChannel( @@ -779,7 +779,7 @@ def verify_permission_roles(self) -> Self: """, # noqa: E501 (line too long) permission_overwrites=[ PermissionOverwrite(roles=ROLES_REGISTERED, deny=["view_channel"]), - PermissionOverwrite(roles=ROLES_ORGANIZERS, allow=["view_channel"]), + PermissionOverwrite(roles=ROLES_ORGANISERS, allow=["view_channel"]), ], ), TextChannel( diff --git a/src/europython_discord/bot.py b/src/europython_discord/bot.py index b29e41ac..02496ae9 100644 --- a/src/europython_discord/bot.py +++ b/src/europython_discord/bot.py @@ -17,8 +17,8 @@ from europython_discord.cogs.ping import PingCog from europython_discord.dog.cog import DogCog from europython_discord.dog.config import DogConfig -from europython_discord.program_notifications.cog import ProgramNotificationsCog -from europython_discord.program_notifications.config import ProgramNotificationsConfig +from europython_discord.programme_notifications.cog import ProgrammeNotificationsCog +from europython_discord.programme_notifications.config import ProgrammeNotificationsConfig from europython_discord.registration.cog import RegistrationCog from europython_discord.registration.config import RegistrationConfig @@ -32,7 +32,7 @@ class Config(BaseModel): log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] registration: RegistrationConfig - program_notifications: ProgramNotificationsConfig + programme_notifications: ProgrammeNotificationsConfig guild_statistics: GuildStatisticsConfig dog: DogConfig @@ -49,7 +49,7 @@ async def run_bot(config: Config, auth_token: str) -> None: await bot.add_cog(PingCog(bot)) await bot.add_cog(DogCog(bot, config.dog)) await bot.add_cog(RegistrationCog(bot, config.registration)) - await bot.add_cog(ProgramNotificationsCog(bot, config.program_notifications)) + await bot.add_cog(ProgrammeNotificationsCog(bot, config.programme_notifications)) await bot.add_cog(GuildStatisticsCog(bot, config.guild_statistics)) await bot.start(auth_token) diff --git a/src/europython_discord/program_notifications/__init__.py b/src/europython_discord/programme_notifications/__init__.py similarity index 100% rename from src/europython_discord/program_notifications/__init__.py rename to src/europython_discord/programme_notifications/__init__.py diff --git a/src/europython_discord/program_notifications/cog.py b/src/europython_discord/programme_notifications/cog.py similarity index 85% rename from src/europython_discord/program_notifications/cog.py rename to src/europython_discord/programme_notifications/cog.py index f58a61c7..dbd61d90 100644 --- a/src/europython_discord/program_notifications/cog.py +++ b/src/europython_discord/programme_notifications/cog.py @@ -7,20 +7,20 @@ from discord.ext import commands, tasks from discord.utils import get as discord_get -from europython_discord.program_notifications import session_to_embed -from europython_discord.program_notifications.config import ProgramNotificationsConfig -from europython_discord.program_notifications.livestream_connector import LivestreamConnector -from europython_discord.program_notifications.models import Session -from europython_discord.program_notifications.program_connector import ProgramConnector +from europython_discord.programme_notifications import session_to_embed +from europython_discord.programme_notifications.config import ProgrammeNotificationsConfig +from europython_discord.programme_notifications.livestream_connector import LivestreamConnector +from europython_discord.programme_notifications.models import Session +from europython_discord.programme_notifications.programme_connector import ProgrammeConnector _logger = logging.getLogger(__name__) -class ProgramNotificationsCog(commands.Cog): - def __init__(self, bot: Client, config: ProgramNotificationsConfig) -> None: +class ProgrammeNotificationsCog(commands.Cog): + def __init__(self, bot: Client, config: ProgrammeNotificationsConfig) -> None: self.bot = bot self.config = config - self.program_connector = ProgramConnector( + self.programme_connector = ProgrammeConnector( api_url=self.config.api_url, cache_file=self.config.schedule_cache_file, simulated_start_time=self.config.simulated_start_time, @@ -30,7 +30,7 @@ def __init__(self, bot: Client, config: ProgramNotificationsConfig) -> None: self.livestream_connector = LivestreamConnector(self.config.livestream_url_file) self.notified_sessions: set[tuple[str, datetime]] = set() - _logger.info("Cog 'Program Notifications' has been initialized") + _logger.info("Cog 'Programme Notifications' has been initialized") @commands.Cog.listener() async def on_ready(self) -> None: @@ -42,7 +42,7 @@ async def on_ready(self) -> None: _logger.debug(f"Fast mode: {self.config.fast_mode}") _logger.info("Starting the session notifier...") self.notify_sessions.start() - _logger.info("Cog 'Program Notifications' is ready") + _logger.info("Cog 'Programme Notifications' is ready") async def cog_load(self) -> None: """Start schedule updater task.""" @@ -66,7 +66,7 @@ async def cog_unload(self) -> None: @tasks.loop(minutes=5) async def fetch_schedule(self) -> None: _logger.info("Starting the periodic schedule update...") - await self.program_connector.fetch_schedule() + await self.programme_connector.fetch_schedule() @tasks.loop(minutes=5) async def fetch_livestreams(self) -> None: @@ -78,7 +78,7 @@ async def fetch_livestreams(self) -> None: async def notify_sessions(self) -> None: # determine sessions to send notifications for sessions_to_notify = [] - for session in await self.program_connector.get_upcoming_sessions(): + for session in await self.programme_connector.get_upcoming_sessions(): if _get_session_key(session) in self.notified_sessions: continue # already notified if len(session.rooms) > 1: diff --git a/src/europython_discord/program_notifications/config.py b/src/europython_discord/programme_notifications/config.py similarity index 89% rename from src/europython_discord/program_notifications/config.py rename to src/europython_discord/programme_notifications/config.py index d5b95934..93a6da93 100644 --- a/src/europython_discord/program_notifications/config.py +++ b/src/europython_discord/programme_notifications/config.py @@ -6,7 +6,7 @@ from pydantic import AwareDatetime, BaseModel -class ProgramNotificationsConfig(BaseModel): +class ProgrammeNotificationsConfig(BaseModel): api_url: str schedule_cache_file: Path livestream_url_file: Path diff --git a/src/europython_discord/program_notifications/livestream_connector.py b/src/europython_discord/programme_notifications/livestream_connector.py similarity index 100% rename from src/europython_discord/program_notifications/livestream_connector.py rename to src/europython_discord/programme_notifications/livestream_connector.py diff --git a/src/europython_discord/program_notifications/models.py b/src/europython_discord/programme_notifications/models.py similarity index 100% rename from src/europython_discord/program_notifications/models.py rename to src/europython_discord/programme_notifications/models.py diff --git a/src/europython_discord/program_notifications/program_connector.py b/src/europython_discord/programme_notifications/programme_connector.py similarity index 95% rename from src/europython_discord/program_notifications/program_connector.py rename to src/europython_discord/programme_notifications/programme_connector.py index d1f2c657..3fc339c6 100644 --- a/src/europython_discord/program_notifications/program_connector.py +++ b/src/europython_discord/programme_notifications/programme_connector.py @@ -9,12 +9,12 @@ import aiofiles import aiohttp -from europython_discord.program_notifications.models import Break, Schedule, Session +from europython_discord.programme_notifications.models import Break, Schedule, Session _logger = logging.getLogger(__name__) -class ProgramConnector: +class ProgrammeConnector: def __init__( self, api_url: str, @@ -51,7 +51,7 @@ async def parse_schedule(self, schedule: dict) -> dict[date, list[Session]]: return sessions_by_day async def fetch_schedule(self) -> None: - """Fetch schedule data from the Program API and write it to a file as backup.""" + """Fetch schedule data from the Programme API and write it to a file as backup.""" async with self._fetch_lock: try: async with ( diff --git a/src/europython_discord/program_notifications/session_to_embed.py b/src/europython_discord/programme_notifications/session_to_embed.py similarity index 98% rename from src/europython_discord/program_notifications/session_to_embed.py rename to src/europython_discord/programme_notifications/session_to_embed.py index 6f293611..f46e9a97 100644 --- a/src/europython_discord/program_notifications/session_to_embed.py +++ b/src/europython_discord/programme_notifications/session_to_embed.py @@ -8,7 +8,7 @@ from discord import Embed from discord.utils import escape_markdown, format_dt -from europython_discord.program_notifications.models import Session, Speaker +from europython_discord.programme_notifications.models import Session, Speaker _AUTHOR_WIDTH: Final = 128 _TWEET_WIDTH: Final = 200 diff --git a/src/europython_discord/registration/cog.py b/src/europython_discord/registration/cog.py index f9a52e95..a28caa9f 100644 --- a/src/europython_discord/registration/cog.py +++ b/src/europython_discord/registration/cog.py @@ -244,7 +244,7 @@ async def cog_unload(self) -> None: await reg_channel.send( f"{WELCOME_MESSAGE_TITLE}\n" "The registration bot is currently offline. " - "We apologize for the inconvenience and are working hard to fix the issue." + "We apologise for the inconvenience and are working hard to fix the issue." ) @tasks.loop(minutes=5) diff --git a/test-config.toml b/test-config.toml index df33d084..e44b329f 100644 --- a/test-config.toml +++ b/test-config.toml @@ -37,24 +37,24 @@ pretix_cache_file = "pretix_cache.json" "Beginners’ Day Unconference / Humble Data Access" = ["Beginners Day"] [registration.variation_to_roles] -# organizers -"Volunteer" = ["Organizers", "Volunteers", "Onsite Volunteers"] +# organisers +"Volunteer" = ["Organisers", "Volunteers", "Onsite Volunteers"] -[program_notifications] +[programme_notifications] # UTC offset in hours (e.g. 2 for CEST) api_url = "https://static.europython.eu/programme/ep2026/releases/current/schedule.json" schedule_cache_file = "schedule_cache.json" livestream_url_file = "test-livestreams.toml" main_notification_channel_name = "programme-notifications" -# optional simulated start time for testing program notifications +# optional simulated start time for testing programme notifications simulated_start_time = "2026-07-15T08:50:00+02:00" -# optional fast mode for faster testing of program notifications +# optional fast mode for faster testing of programme notifications # will only take effect if simulated_start_time is set fast_mode = true -[program_notifications.rooms_to_channel_names] +[programme_notifications.rooms_to_channel_names] "S1" = "s1" "S2" = "s2" "S3A" = "s3a" @@ -63,7 +63,7 @@ fast_mode = true "Exhibit Hall" = "exhibit-hall" [guild_statistics] -required_role = "Organizers" +required_role = "Organisers" [dog] channel_name = "animal-appreciation" diff --git a/tests/program_notifications/test_program_connector.py b/tests/program_notifications/test_program_connector.py index 639bf44a..a329915e 100644 --- a/tests/program_notifications/test_program_connector.py +++ b/tests/program_notifications/test_program_connector.py @@ -9,7 +9,7 @@ from aiohttp import web from aiohttp.test_utils import TestServer -from europython_discord.program_notifications.program_connector import ProgramConnector +from europython_discord.programme_notifications.programme_connector import ProgrammeConnector mock_schedule_file = Path(__file__).parent / "mock_schedule.json" @@ -26,8 +26,8 @@ def cache_file(tmp_path): @pytest.fixture -async def program_connector(cache_file): - return ProgramConnector(api_url="http://test.api/schedule", cache_file=cache_file) +async def programme_connector(cache_file): + return ProgrammeConnector(api_url="http://test.api/schedule", cache_file=cache_file) @pytest.fixture @@ -47,8 +47,8 @@ async def mock_schedule_url(mock_client): return str(mock_client.make_url("/schedule")) -async def test_parse_schedule(program_connector, mock_schedule): - sessions_by_day = await program_connector.parse_schedule(mock_schedule) +async def test_parse_schedule(programme_connector, mock_schedule): + sessions_by_day = await programme_connector.parse_schedule(mock_schedule) assert len(sessions_by_day) == 3 @@ -57,21 +57,21 @@ async def test_parse_schedule(program_connector, mock_schedule): assert len(sessions_by_day[date(2024, 7, 12)]) == 3 -async def test_fetch_schedule(program_connector, mock_schedule_url, cache_file, mock_schedule): - program_connector._api_url = mock_schedule_url +async def test_fetch_schedule(programme_connector, mock_schedule_url, cache_file, mock_schedule): + programme_connector._api_url = mock_schedule_url - await program_connector.fetch_schedule() + await programme_connector.fetch_schedule() async with aiofiles.open(cache_file) as f: cached_data = json.loads(await f.read()) assert cached_data == mock_schedule -async def test_get_schedule_from_cache(program_connector, mock_schedule, cache_file): +async def test_get_schedule_from_cache(programme_connector, mock_schedule, cache_file): async with aiofiles.open(cache_file, "w") as f: await f.write(json.dumps(mock_schedule)) - sessions_by_day = await program_connector._get_schedule_from_cache() + sessions_by_day = await programme_connector._get_schedule_from_cache() assert len(sessions_by_day) == 3 assert len(sessions_by_day[date(2024, 7, 10)]) == 4 @@ -79,13 +79,13 @@ async def test_get_schedule_from_cache(program_connector, mock_schedule, cache_f assert len(sessions_by_day[date(2024, 7, 12)]) == 3 -async def test_get_sessions_by_date(program_connector, mock_schedule_url): - program_connector._api_url = mock_schedule_url +async def test_get_sessions_by_date(programme_connector, mock_schedule_url): + programme_connector._api_url = mock_schedule_url - await program_connector.fetch_schedule() + await programme_connector.fetch_schedule() # Test for July 10th - sessions = await program_connector.get_sessions_by_date(date(2024, 7, 10)) + sessions = await programme_connector.get_sessions_by_date(date(2024, 7, 10)) assert len(sessions) == 4 assert sessions[0].title == "Wednesday Registration & Welcome @ Forum Hall Foyer 1st Floor" assert ( @@ -95,37 +95,37 @@ async def test_get_sessions_by_date(program_connector, mock_schedule_url): assert sessions[2].title == "Learning to code in the age of AI" # Test for July 11th - sessions = await program_connector.get_sessions_by_date(date(2024, 7, 11)) + sessions = await programme_connector.get_sessions_by_date(date(2024, 7, 11)) assert len(sessions) == 3 assert sessions[0].title == "Thursday Registration & Welcome @ Forum Hall Foyer 1st Floor" assert sessions[1].title == "Why should we all be hyped about inclusive leadership?" assert sessions[2].title == "Rapid Prototyping & Proof of Concepts: Django is all we need" # Test for July 12th - sessions = await program_connector.get_sessions_by_date(date(2024, 7, 12)) + sessions = await programme_connector.get_sessions_by_date(date(2024, 7, 12)) assert len(sessions) == 3 assert sessions[0].title == "Friday Registration & Welcome @ Forum Hall Foyer 1st Floor" assert sessions[1].title == "Healthy code for healthy teams (or the other way around)" assert sessions[2].title == "Insights and Experiences of Packaging Python Binary Extensions" # Test for a day with no sessions - sessions = await program_connector.get_sessions_by_date(date(2024, 7, 13)) + sessions = await programme_connector.get_sessions_by_date(date(2024, 7, 13)) assert len(sessions) == 0 -async def test_get_upcoming_sessions(program_connector, mock_schedule_url): - program_connector._api_url = mock_schedule_url +async def test_get_upcoming_sessions(programme_connector, mock_schedule_url): + programme_connector._api_url = mock_schedule_url - await program_connector.fetch_schedule() + await programme_connector.fetch_schedule() # Please make sure all the sessions have UTC+0 timezone # Test with a simulated time in 5 minutes range before a session - program_connector._simulated_start_time = datetime(2024, 7, 10, 7, 58, 0, tzinfo=UTC) - program_connector._real_start_time = datetime.now(tz=UTC) - program_connector._time_multiplier = 1 + programme_connector._simulated_start_time = datetime(2024, 7, 10, 7, 58, 0, tzinfo=UTC) + programme_connector._real_start_time = datetime.now(tz=UTC) + programme_connector._time_multiplier = 1 - upcoming_sessions = await program_connector.get_upcoming_sessions() + upcoming_sessions = await programme_connector.get_upcoming_sessions() assert len(upcoming_sessions) == 1 assert ( upcoming_sessions[0].title @@ -133,28 +133,28 @@ async def test_get_upcoming_sessions(program_connector, mock_schedule_url): ) # Test with a simulated time in 5 minutes range where there are 2 upcoming sessions - program_connector._simulated_start_time = datetime(2024, 7, 10, 10, 43, 0, tzinfo=UTC) - upcoming_sessions = await program_connector.get_upcoming_sessions() + programme_connector._simulated_start_time = datetime(2024, 7, 10, 10, 43, 0, tzinfo=UTC) + upcoming_sessions = await programme_connector.get_upcoming_sessions() assert len(upcoming_sessions) == 2 # Test with a simulated time before any session in the mock schedule - program_connector._simulated_start_time = datetime(2024, 7, 10, 7, 0, 0, tzinfo=UTC) - upcoming_sessions = await program_connector.get_upcoming_sessions() + programme_connector._simulated_start_time = datetime(2024, 7, 10, 7, 0, 0, tzinfo=UTC) + upcoming_sessions = await programme_connector.get_upcoming_sessions() assert len(upcoming_sessions) == 0 # Test with a simulated time after all sessions in the mock schedule - program_connector._simulated_start_time = datetime(2024, 7, 11, 11, 20, 0, tzinfo=UTC) - upcoming_sessions = await program_connector.get_upcoming_sessions() + programme_connector._simulated_start_time = datetime(2024, 7, 11, 11, 20, 0, tzinfo=UTC) + upcoming_sessions = await programme_connector.get_upcoming_sessions() assert len(upcoming_sessions) == 0 # Test with a simulated time in 5 minutes range before a break - program_connector._simulated_start_time = datetime(2024, 7, 12, 10, 13, 0, tzinfo=UTC) - upcoming_sessions = await program_connector.get_upcoming_sessions() + programme_connector._simulated_start_time = datetime(2024, 7, 12, 10, 13, 0, tzinfo=UTC) + upcoming_sessions = await programme_connector.get_upcoming_sessions() assert len(upcoming_sessions) == 0 async def test_fetch_schedule_error_handling( - program_connector, unused_tcp_port_factory, aiohttp_client + programme_connector, unused_tcp_port_factory, aiohttp_client ): async def mock_api_handler(request): # noqa: ARG001 (unused argument) return web.Response(status=HTTPStatus.INTERNAL_SERVER_ERROR) @@ -165,32 +165,32 @@ async def mock_api_handler(request): # noqa: ARG001 (unused argument) server = TestServer(app, port=unused_tcp_port_factory()) client = await aiohttp_client(server) - program_connector._api_url = str(client.make_url("/schedule")) + programme_connector._api_url = str(client.make_url("/schedule")) - await program_connector.fetch_schedule() + await programme_connector.fetch_schedule() - assert program_connector.sessions_by_day is None + assert programme_connector.sessions_by_day is None -async def test_get_sessions_by_date_with_empty_schedule(program_connector): - sessions = await program_connector.get_sessions_by_date(date(2024, 7, 10)) +async def test_get_sessions_by_date_with_empty_schedule(programme_connector): + sessions = await programme_connector.get_sessions_by_date(date(2024, 7, 10)) assert len(sessions) == 0 -async def test_get_now_with_simulation(program_connector): +async def test_get_now_with_simulation(programme_connector): simulated_start_time = datetime(2024, 7, 10, 8, 0, 0, tzinfo=UTC) - program_connector._simulated_start_time = simulated_start_time - program_connector._real_start_time = datetime.now(tz=UTC) - program_connector._time_multiplier = 60 + programme_connector._simulated_start_time = simulated_start_time + programme_connector._real_start_time = datetime.now(tz=UTC) + programme_connector._time_multiplier = 60 # ensure time is ticking between start and finish of this test await asyncio.sleep(0.001) - assert await program_connector._get_now() > simulated_start_time + assert await programme_connector._get_now() > simulated_start_time -async def test_get_now_without_simulation(program_connector): - now = await program_connector._get_now() +async def test_get_now_without_simulation(programme_connector): + now = await programme_connector._get_now() # ensure time is ticking between start and finish of this test await asyncio.sleep(0.001) diff --git a/tests/program_notifications/test_session_to_embed.py b/tests/program_notifications/test_session_to_embed.py index 6029b1ef..c46ba53c 100644 --- a/tests/program_notifications/test_session_to_embed.py +++ b/tests/program_notifications/test_session_to_embed.py @@ -2,9 +2,9 @@ import pytest -from europython_discord.program_notifications import session_to_embed -from europython_discord.program_notifications.models import Session, Speaker -from europython_discord.program_notifications.session_to_embed import ( +from europython_discord.programme_notifications import session_to_embed +from europython_discord.programme_notifications.models import Session, Speaker +from europython_discord.programme_notifications.session_to_embed import ( _AUTHOR_WIDTH, _FIELD_VALUE_EMPTY, _TITLE_WIDTH,