aboutsummaryrefslogtreecommitdiff
path: root/test_utils/models
diff options
context:
space:
mode:
authorMax Nanis2026-08-21 17:19:41 -0700
committerMax Nanis2026-08-21 17:19:41 -0700
commit6cf7ccbaa8306700e64ada19d6f99807743b2865 (patch)
tree16ccde36ba2694b8c03bf8bdcee9cfcb2909046a /test_utils/models
parent352520a2bd4ac066e90587e44d8b818043407917 (diff)
downloadgeneralresearch-6cf7ccbaa8306700e64ada19d6f99807743b2865.tar.gz
generalresearch-6cf7ccbaa8306700e64ada19d6f99807743b2865.zip
Ruff auto updates to 3.14
Diffstat (limited to 'test_utils/models')
-rw-r--r--test_utils/models/conftest.py7
-rw-r--r--test_utils/models/contest/conftest.py7
-rw-r--r--test_utils/models/gr/conftest.py2
-rw-r--r--test_utils/models/ledger/conftest.py3
-rw-r--r--test_utils/models/network/conftest.py6
-rw-r--r--test_utils/models/thl/conftest.py17
6 files changed, 22 insertions, 20 deletions
diff --git a/test_utils/models/conftest.py b/test_utils/models/conftest.py
index 93e2f44..3a9e45c 100644
--- a/test_utils/models/conftest.py
+++ b/test_utils/models/conftest.py
@@ -1,10 +1,11 @@
from __future__ import annotations
-from datetime import datetime, timedelta, timezone
+from collections.abc import Callable
+from datetime import UTC, datetime, timedelta, timezone
from decimal import Decimal
from random import choice as randchoice
from random import randint
-from typing import TYPE_CHECKING, Callable
+from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
@@ -124,7 +125,7 @@ def wall_factory(wall_manager: WallManager) -> Callable[..., Wall]:
) -> Wall:
assert session.started <= datetime.now(
- tz=timezone.utc
+ tz=UTC
), "Session can't start in the future"
if session.wall_events:
diff --git a/test_utils/models/contest/conftest.py b/test_utils/models/contest/conftest.py
index bfbe9f8..0060946 100644
--- a/test_utils/models/contest/conftest.py
+++ b/test_utils/models/contest/conftest.py
@@ -1,14 +1,13 @@
from __future__ import annotations
-from datetime import datetime, timezone
+from collections.abc import Callable
+from datetime import UTC, datetime, timezone
from decimal import Decimal
-from typing import Callable
from uuid import uuid4
import pytest
from pytest import FixtureRequest as Request
-
from generalresearch.currency import USDCent
from generalresearch.managers.thl.contest_manager import ContestManager
from generalresearch.managers.thl.ledger_manager.thl_ledger import ThlLedgerManager
@@ -136,7 +135,7 @@ def milestone_contest_create() -> MilestoneContestCreate:
),
],
end_condition=MilestoneContestEndCondition(
- ends_at=datetime(year=2030, month=1, day=1, tzinfo=timezone.utc),
+ ends_at=datetime(year=2030, month=1, day=1, tzinfo=UTC),
max_winners=5,
),
entry_trigger=ContestEntryTrigger.TASK_COMPLETE,
diff --git a/test_utils/models/gr/conftest.py b/test_utils/models/gr/conftest.py
index df97306..90b86aa 100644
--- a/test_utils/models/gr/conftest.py
+++ b/test_utils/models/gr/conftest.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import Callable
+from collections.abc import Callable
from uuid import uuid4
import pytest
diff --git a/test_utils/models/ledger/conftest.py b/test_utils/models/ledger/conftest.py
index 14a7465..b428468 100644
--- a/test_utils/models/ledger/conftest.py
+++ b/test_utils/models/ledger/conftest.py
@@ -1,9 +1,10 @@
from __future__ import annotations
+from collections.abc import Callable
from datetime import datetime
from decimal import Decimal
from random import randint
-from typing import TYPE_CHECKING, Callable
+from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
diff --git a/test_utils/models/network/conftest.py b/test_utils/models/network/conftest.py
index bebc691..cabd8dc 100644
--- a/test_utils/models/network/conftest.py
+++ b/test_utils/models/network/conftest.py
@@ -1,5 +1,5 @@
import os
-from datetime import datetime, timedelta, timezone
+from datetime import UTC, datetime, timedelta, timezone
from uuid import uuid4
import pytest
@@ -90,7 +90,7 @@ def rdns_result(dig_raw_output: str) -> RDNSResult:
def rdns_run(rdns_result: RDNSResult, scan_group_id: str):
r = rdns_result
ip = "45.33.32.156"
- utc_now = datetime.now(tz=timezone.utc)
+ utc_now = datetime.now(tz=UTC)
config = RDNSRunCommand(command="dig", options=RDNSRunCommandOptions(ip=ip))
return RDNSRun(
tool_version="1.2.3",
@@ -121,7 +121,7 @@ def mtr_result(mtr_raw_output: str) -> MTRResult:
@pytest.fixture(scope="session")
def mtr_run(mtr_result: MTRResult, scan_group_id: str):
r = mtr_result
- utc_now = datetime.now(tz=timezone.utc)
+ utc_now = datetime.now(tz=UTC)
config = MTRRunCommand(
command="mtr",
options=MTRRunCommandOptions(
diff --git a/test_utils/models/thl/conftest.py b/test_utils/models/thl/conftest.py
index cf8d2fa..a2adcce 100644
--- a/test_utils/models/thl/conftest.py
+++ b/test_utils/models/thl/conftest.py
@@ -1,11 +1,12 @@
from __future__ import annotations
-from datetime import datetime, timezone
+from collections.abc import Callable
+from datetime import UTC, datetime, timezone
from decimal import ROUND_DOWN, Decimal
from random import choice as rand_choice
from random import choice as rchoice
from random import randint, random
-from typing import Any, Callable
+from typing import Any
from uuid import uuid4
import faker
@@ -105,9 +106,9 @@ def wall_factory(
user_id = user_id or fake.random_int(min=1, max=2_147_483_648)
started = started or fake.date_time_between(
- start_date=datetime(year=1900, month=1, day=1, tzinfo=timezone.utc),
- end_date=datetime.now(tz=timezone.utc),
- tzinfo=timezone.utc,
+ start_date=datetime(year=1900, month=1, day=1, tzinfo=UTC),
+ end_date=datetime.now(tz=UTC),
+ tzinfo=UTC,
)
if session_id is None:
@@ -199,9 +200,9 @@ def session_factory(session_manager: SessionManager):
) -> Session:
"""To be used in tests, where we don't care about certain fields"""
started = started or fake.date_time_between(
- start_date=datetime(year=1900, month=1, day=1, tzinfo=timezone.utc),
- end_date=datetime(year=2000, month=1, day=1, tzinfo=timezone.utc),
- tzinfo=timezone.utc,
+ start_date=datetime(year=1900, month=1, day=1, tzinfo=UTC),
+ end_date=datetime(year=2000, month=1, day=1, tzinfo=UTC),
+ tzinfo=UTC,
)
user = user or User(
user_id=fake.random_int(min=1, max=2_147_483_648), uuid=uuid4().hex