Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): freeze the easybill date-range test clock (#127966)

posthog[bot]3c834cabf1d4
diff --git a/products/warehouse_sources/sources/easybill/tests/test_easybill.py b/products/warehouse_sources/sources/easybill/tests/test_easybill.py
index 67ce4e2811a9..bcb999bc3592 100644
--- a/products/warehouse_sources/sources/easybill/tests/test_easybill.py
+++ b/products/warehouse_sources/sources/easybill/tests/test_easybill.py
@@ -2,6 +2,7 @@ from datetime import UTC, date, datetime
from typing import Any
import pytest
+import time_machine
from parameterized import parameterized
from requests import HTTPError
@@ -46,20 +47,22 @@ def _response(
class TestDateRangeSince:
@parameterized.expand(
[
- ("datetime", datetime(2024, 3, 10, 12, 0, tzinfo=UTC), f"2024-03-09,{date.today().isoformat()}"),
- ("date", date(2024, 3, 10), f"2024-03-09,{date.today().isoformat()}"),
- ("iso_string", "2024-03-10T00:00:00+00:00", f"2024-03-09,{date.today().isoformat()}"),
- ("iso_string_z", "2024-03-10T00:00:00Z", f"2024-03-09,{date.today().isoformat()}"),
- ("plain_date_string", "2024-03-10", f"2024-03-09,{date.today().isoformat()}"),
+ ("datetime", datetime(2024, 3, 10, 12, 0, tzinfo=UTC), "2024-03-09,2024-03-15"),
+ ("date", date(2024, 3, 10), "2024-03-09,2024-03-15"),
+ ("iso_string", "2024-03-10T00:00:00+00:00", "2024-03-09,2024-03-15"),
+ ("iso_string_z", "2024-03-10T00:00:00Z", "2024-03-09,2024-03-15"),
+ ("plain_date_string", "2024-03-10", "2024-03-09,2024-03-15"),
("none", None, None),
("garbage_string", "not-a-date", None),
]
)
+ @time_machine.travel(datetime(2024, 3, 15, 12, tzinfo=UTC), tick=False)
def test_date_range_since(self, _name: str, value: Any, expected: str | None) -> None:
assert date_range_since(value) == expected
class TestIncrementalParams:
+ @time_machine.travel(datetime(2024, 3, 15, 12, tzinfo=UTC), tick=False)
def test_documents_incremental_adds_edited_at_range(self) -> None:
result = _driver().run(
"Documents",
@@ -69,7 +72,7 @@ class TestIncrementalParams:
)
assert result.raised is None
- assert result.requests[0].param("edited_at") == f"2024-03-09,{date.today().isoformat()}"
+ assert result.requests[0].param("edited_at") == "2024-03-09,2024-03-15"
assert result.requests[0].param("limit") == "1000"
assert result.requests[0].param("page") == "1"