From 22b90fdceeca85d010de4d1e3444a0810f00a531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Thu, 30 Jan 2025 02:44:12 +0100 Subject: [PATCH] Lower Python requirement to 3.10 instead of 3.13 --- noxfile.py | 13 +++++++++++++ pyproject.toml | 14 +++----------- tests/test_misc.py | 12 ++++++------ 3 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 noxfile.py diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..c81070f --- /dev/null +++ b/noxfile.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +import nox # type: ignore[import] + +nox.options.default_venv_backend = "uv" + + +@nox.session(python=["3.10", "3.11", "3.12", "3.13"]) +def tests(session: nox.Session) -> None: + """Run the test suite.""" + session.install(".") + session.install("pytest") + session.run("pytest") diff --git a/pyproject.toml b/pyproject.toml index 3212db4..7d89558 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,9 @@ -# TODO(TheLovinator): Add GitHub Actions workflow for installing and running with Poetry -# TODO(TheLovinator): Add GitHub Actions workflow for installing and running with uv -# TODO(TheLovinator): Test bot on linux/windows/macOS with different Python versions and architectures - [project] name = "discord-reminder-bot" version = "2.0.0" description = "Discord bot that allows you to set date, cron and interval reminders." readme = "README.md" -requires-python = ">=3.13" +requires-python = ">=3.10" dependencies = [ # The Discord bot library uses discord.py # legacy-cgi and audioop-lts are because Python 3.13 removed cgi module and audioop module @@ -36,7 +32,7 @@ dependencies = [ ] [dependency-groups] -dev = ["pytest", "ruff", "pre-commit", "pytest-asyncio", "freezegun"] +dev = ["pytest"] [tool.poetry] name = "discord-reminder-bot" @@ -49,7 +45,7 @@ license = "GPL-3.0-or-later" bot = "discord_reminder_bot.main:start" [tool.poetry.dependencies] -python = "^3.13" +python = "^3.10" # https://github.com/agronholm/apscheduler # https://github.com/sqlalchemy/sqlalchemy @@ -88,10 +84,6 @@ loguru = {version = ">=0.7.3,<1.0.0"} [tool.poetry.dev-dependencies] pytest = "*" -pre-commit = "*" -ruff = "*" -pytest-asyncio = "*" -freezegun = "*" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/tests/test_misc.py b/tests/test_misc.py index 42d71dc..3fc4ef9 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1,6 +1,6 @@ from __future__ import annotations -from datetime import UTC, datetime, timedelta +from datetime import datetime, timedelta, timezone from typing import TYPE_CHECKING from apscheduler.schedulers.background import BackgroundScheduler @@ -14,22 +14,22 @@ if TYPE_CHECKING: def test_calc_time() -> None: """Test the calc_time function with various datetime inputs.""" - test_datetime: datetime = datetime(2023, 10, 1, 12, 0, 0, tzinfo=UTC) + test_datetime: datetime = datetime(2023, 10, 1, 12, 0, 0, tzinfo=timezone.utc) expected_timestamp: str = f"" assert_msg = f"Expected {expected_timestamp}, got {calc_time(test_datetime)}" assert calc_time(test_datetime) == expected_timestamp, assert_msg - now: datetime = datetime.now(tz=UTC) + now: datetime = datetime.now(tz=timezone.utc) expected_timestamp_now: str = f"" assert_msg = f"Expected {expected_timestamp_now}, got {calc_time(now)}" assert calc_time(now) == expected_timestamp_now, assert_msg - past_datetime: datetime = datetime(2000, 1, 1, 0, 0, 0, tzinfo=UTC) + past_datetime: datetime = datetime(2000, 1, 1, 0, 0, 0, tzinfo=timezone.utc) expected_timestamp_past: str = f"" assert_msg = f"Expected {expected_timestamp_past}, got {calc_time(past_datetime)}" assert calc_time(past_datetime) == expected_timestamp_past, assert_msg - future_datetime: datetime = datetime(2100, 1, 1, 0, 0, 0, tzinfo=UTC) + future_datetime: datetime = datetime(2100, 1, 1, 0, 0, 0, tzinfo=timezone.utc) expected_timestamp_future: str = f"" assert_msg: str = f"Expected {expected_timestamp_future}, got {calc_time(future_datetime)}" assert calc_time(future_datetime) == expected_timestamp_future, assert_msg @@ -69,7 +69,7 @@ def test_calculate() -> None: scheduler.start() # Create a job with a DateTrigger - run_date = datetime(2270, 10, 1, 12, 0, 0, tzinfo=UTC) + run_date = datetime(2270, 10, 1, 12, 0, 0, tzinfo=timezone.utc) job: Job = scheduler.add_job(lambda: None, trigger=DateTrigger(run_date=run_date), id="test_job", name="Test Job") expected_output = ""