Skip to content

Commit

Permalink
fix(ingest): resolve issue with caplog and asyncio (datahub-project#9377
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hsheth2 authored Dec 5, 2023
1 parent 4ec3208 commit 7517c77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def resolve_includes(
@dataclass
class LookerViewFile:
absolute_file_path: str
connection: Optional[str]
connection: Optional[LookerConnectionDefinition]
includes: List[str]
resolved_includes: List[ProjectInclude]
views: List[Dict]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Dict, Iterable, List, Union
from unittest.mock import patch

import pytest
from freezegun import freeze_time

import datahub.metadata.schema_classes as models
Expand Down Expand Up @@ -482,7 +483,7 @@ def test_auto_browse_path_v2_dry_run(telemetry_ping_mock):


@freeze_time("2023-01-02 00:00:00")
def test_auto_empty_dataset_usage_statistics(caplog):
def test_auto_empty_dataset_usage_statistics(caplog: pytest.LogCaptureFixture) -> None:
has_urn = make_dataset_urn("my_platform", "has_aspect")
empty_urn = make_dataset_urn("my_platform", "no_aspect")
config = BaseTimeWindowConfig()
Expand All @@ -499,6 +500,7 @@ def test_auto_empty_dataset_usage_statistics(caplog):
),
).as_workunit()
]
caplog.clear()
with caplog.at_level(logging.WARNING):
new_wus = list(
auto_empty_dataset_usage_statistics(
Expand Down Expand Up @@ -530,7 +532,9 @@ def test_auto_empty_dataset_usage_statistics(caplog):


@freeze_time("2023-01-02 00:00:00")
def test_auto_empty_dataset_usage_statistics_invalid_timestamp(caplog):
def test_auto_empty_dataset_usage_statistics_invalid_timestamp(
caplog: pytest.LogCaptureFixture,
) -> None:
urn = make_dataset_urn("my_platform", "my_dataset")
config = BaseTimeWindowConfig()
wus = [
Expand All @@ -546,6 +550,7 @@ def test_auto_empty_dataset_usage_statistics_invalid_timestamp(caplog):
),
).as_workunit()
]
caplog.clear()
with caplog.at_level(logging.WARNING):
new_wus = list(
auto_empty_dataset_usage_statistics(
Expand Down
2 changes: 1 addition & 1 deletion metadata-ingestion/tests/unit/utilities/test_perf_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from datahub.utilities.perf_timer import PerfTimer

approx = partial(pytest.approx, rel=1e-2)
approx = partial(pytest.approx, rel=2e-2)


def test_perf_timer_simple():
Expand Down

0 comments on commit 7517c77

Please sign in to comment.