Skip to content

Commit

Permalink
Remove use of deprecated module in psycopg2 (#13818)
Browse files Browse the repository at this point in the history
* Use datetime

* Try CI with only python 3.8 coverage

* One attempt to get timezone in a compatible way

* Revert "Try CI with only python 3.8 coverage"

This reverts commit 63aaac8.

* Can I do python?

* Will this work?

---------

Co-authored-by: Alex Normand <[email protected]>
  • Loading branch information
alexbarksdale and alexandre-normand authored Apr 12, 2023
1 parent 16e5421 commit d4a7505
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions postgres/tests/test_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from datadog_checks.base.utils.db.sql import compute_sql_signature
from datadog_checks.base.utils.db.utils import DBMAsyncJob
from datadog_checks.base.utils.serialization import json
from datadog_checks.base.utils.time import UTC
from datadog_checks.postgres.statement_samples import DBExplainError, StatementTruncationState
from datadog_checks.postgres.statements import PG_STAT_STATEMENTS_METRICS_COLUMNS, PG_STAT_STATEMENTS_TIMING_COLUMNS

Expand All @@ -41,8 +42,6 @@

dbm_enabled_keys = ["dbm", "deep_database_monitoring"]

DEFAULT_TZ_INFO = psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)


@pytest.fixture(autouse=True)
def stop_orphaned_threads():
Expand Down Expand Up @@ -1023,15 +1022,15 @@ def test_activity_reported_hostname(


def new_time():
return datetime.datetime(2021, 9, 23, 23, 21, 21, 669330, tzinfo=DEFAULT_TZ_INFO)
return datetime.datetime(2021, 9, 23, 23, 21, 21, 669330, tzinfo=UTC)


def old_time():
return datetime.datetime(2021, 9, 22, 22, 21, 21, 669330, tzinfo=DEFAULT_TZ_INFO)
return datetime.datetime(2021, 9, 22, 22, 21, 21, 669330, tzinfo=UTC)


def very_old_time():
return datetime.datetime(2021, 9, 20, 23, 21, 21, 669330, tzinfo=DEFAULT_TZ_INFO)
return datetime.datetime(2021, 9, 20, 23, 21, 21, 669330, tzinfo=UTC)


@pytest.mark.parametrize(
Expand Down

0 comments on commit d4a7505

Please sign in to comment.