Lower Python requirement to 3.10 instead of 3.13
This commit is contained in:
13
noxfile.py
Normal file
13
noxfile.py
Normal file
@ -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")
|
@ -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"]
|
||||
|
@ -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"<t:{int(test_datetime.timestamp())}:R>"
|
||||
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"<t:{int(now.timestamp())}:R>"
|
||||
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"<t:{int(past_datetime.timestamp())}:R>"
|
||||
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"<t:{int(future_datetime.timestamp())}:R>"
|
||||
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 = "<t:9490737600:R>"
|
||||
|
Reference in New Issue
Block a user