Skip to content

Commit 3fe8efb

Browse files
committed
postgres data-observability - fix lint errors in test_data_observability.py
Newer ddev catches three issues older ddev missed: misplaced calendar/datetime imports below an inline comment block, plus two unused locals (tick_time, next_run). Moves the imports to the top of the file and removes the unused assignments. Signed-off-by: mobuchowski <maciej.obuchowski@datadoghq.com>
1 parent 4e739fc commit 3fe8efb

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

postgres/tests/test_data_observability.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Licensed under a 3-clause BSD style license (see LICENSE)
44
from __future__ import annotations
55

6+
import calendar
7+
import datetime
68
import json
79
from contextlib import contextmanager
810
from copy import deepcopy
@@ -24,9 +26,6 @@
2426
#
2527
# We use an absolute epoch so croniter's calendar arithmetic stays stable.
2628
# 2026-01-01 00:49:00 UTC → 1751331940 (approx; exact value computed below)
27-
import calendar
28-
import datetime
29-
3029
_BASE_EPOCH = calendar.timegm(datetime.datetime(2026, 1, 1, 0, 49, 0).timetuple()) # 00:49:00 UTC
3130

3231
pytestmark = pytest.mark.unit
@@ -698,7 +697,6 @@ def test_neither_set_skipped(pg_instance, aggregator):
698697
def test_lateness_metric_emitted_for_cron(pg_instance, aggregator, monkeypatch):
699698
"""Cron query fired late emits a positive lateness gauge with mode:cron tag."""
700699
# next_run will be at 00:50:00; fire at 00:52:00 → 120s lateness
701-
tick_time = float(_BASE_EPOCH + 60) # 00:50:00 exactly
702700
fire_time = float(_BASE_EPOCH + 180) # 00:52:00
703701

704702
call_count = [0]
@@ -785,7 +783,6 @@ def test_lateness_clamped_at_zero(pg_instance, aggregator, monkeypatch):
785783
# First call: registers next_run = 01:50:00 (future)
786784
check.data_observability.run_job()
787785
mid = CRON_QUERY['monitor_id']
788-
next_run = check.data_observability._next_run[mid]
789786

790787
# Manually set next_run to a value slightly in the future to simulate skew
791788
# (i.e., scheduled_fire_time > now_at_fire_start)

0 commit comments

Comments
 (0)