Skip to content

Commit b9578dc

Browse files
committed
test: keep UTC import inside platform-uploaded main() bodies
The previous ruff autofix (UP017) hoisted `from datetime import UTC` to module scope, but `main()` functions passed to `make_actor` are serialized and run on the Apify platform without access to enclosing-module imports, so they raised `NameError: name 'UTC' is not defined` at runtime.
1 parent 057df56 commit b9578dc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎tests/e2e/test_actor_call_timeouts.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import asyncio
4-
from datetime import UTC
54
from typing import TYPE_CHECKING
65

76
from apify import Actor
@@ -20,7 +19,7 @@ async def test_actor_start_inherit_timeout(
2019
Timeout should be the remaining time of the first Actor run calculated at the moment of the other Actor start."""
2120

2221
async def main() -> None:
23-
from datetime import datetime, timedelta
22+
from datetime import UTC, datetime, timedelta
2423

2524
async with Actor:
2625
actor_input = (await Actor.get_input()) or {}
@@ -70,7 +69,7 @@ async def test_actor_call_inherit_timeout(
7069
Timeout should be the remaining time of the first Actor run calculated at the moment of the other Actor call."""
7170

7271
async def main() -> None:
73-
from datetime import datetime, timedelta
72+
from datetime import UTC, datetime, timedelta
7473

7574
async with Actor:
7675
actor_input = (await Actor.get_input()) or {}

0 commit comments

Comments
 (0)