fix(ingest): resolve issue with caplog and asyncio (#9377)

This commit is contained in:
Harshal Sheth 2023-12-04 20:00:11 -05:00 committed by GitHub
parent 4ec3208918
commit 7517c77ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -550,7 +550,7 @@ class LookerModel:
@dataclass
class LookerViewFile:
absolute_file_path: str
connection: Optional[str]
connection: Optional[LookerConnectionDefinition]
includes: List[str]
resolved_includes: List[ProjectInclude]
views: List[Dict]

View File

@ -3,6 +3,7 @@ from datetime import datetime
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
@ -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()
@ -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(
@ -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 = [
@ -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(

View File

@ -5,7 +5,7 @@ import pytest
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():