fix(ci): smoke test lint failures (#11044)

This commit is contained in:
Shirshanka Das 2024-07-30 16:33:00 -07:00 committed by GitHub
parent 7d4b645225
commit a734d69a6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 16 deletions

View File

@ -1,18 +1,33 @@
import setuptools import setuptools
import os
folders = ["./smoke-test/tests"] folders = ["./smoke-test/tests"]
for folder in folders: for folder in folders:
print(f"Checking folder {folder}") print(f"Checking folder {folder}")
a = [i for i in setuptools.find_packages(folder) if "cypress" not in i] packages = [i for i in setuptools.find_packages(folder) if "cypress" not in i]
b = [i for i in setuptools.find_namespace_packages(folder) if "cypress" not in i] namespace_packages = [
i for i in setuptools.find_namespace_packages(folder) if "cypress" not in i
]
in_a_not_b = set(a) - set(b) print("Packages found:", packages)
in_b_not_a = set(b) - set(a) print("Namespace packages found:", namespace_packages)
in_packages_not_namespace = set(packages) - set(namespace_packages)
in_namespace_not_packages = set(namespace_packages) - set(packages)
if in_packages_not_namespace:
print(f"Packages not in namespace packages: {in_packages_not_namespace}")
if in_namespace_not_packages:
print(f"Namespace packages not in packages: {in_namespace_not_packages}")
for pkg in in_namespace_not_packages:
pkg_path = os.path.join(folder, pkg.replace(".", os.path.sep))
print(f"Contents of {pkg_path}:")
print(os.listdir(pkg_path))
assert ( assert (
len(in_a_not_b) == 0 len(in_packages_not_namespace) == 0
), f"Found packages in {folder} that are not in namespace packages: {in_a_not_b}" ), f"Found packages in {folder} that are not in namespace packages: {in_packages_not_namespace}"
assert ( assert (
len(in_b_not_a) == 0 len(in_namespace_not_packages) == 0
), f"Found namespace packages in {folder} that are not in packages: {in_b_not_a}" ), f"Found namespace packages in {folder} that are not in packages: {in_namespace_not_packages}"

View File

@ -6,10 +6,7 @@ from random import randint
import datahub.metadata.schema_classes as models import datahub.metadata.schema_classes as models
import pytest import pytest
from datahub.emitter.mce_builder import ( from datahub.emitter.mce_builder import make_dataset_urn, make_schema_field_urn
make_dataset_urn,
make_schema_field_urn,
)
from datahub.emitter.mcp import MetadataChangeProposalWrapper from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.ingestion.api.common import PipelineContext, RecordEnvelope from datahub.ingestion.api.common import PipelineContext, RecordEnvelope
from datahub.ingestion.api.sink import NoopWriteCallback from datahub.ingestion.api.sink import NoopWriteCallback

View File

@ -119,9 +119,11 @@ def create_property_definition(
qualifiedName=f"{namespace}.{property_name}", qualifiedName=f"{namespace}.{property_name}",
valueType=Urn.make_data_type_urn(value_type), valueType=Urn.make_data_type_urn(value_type),
description="The retention policy for the dataset", description="The retention policy for the dataset",
entityTypes=[Urn.make_entity_type_urn(e) for e in entity_types] entityTypes=(
if entity_types [Urn.make_entity_type_urn(e) for e in entity_types]
else [Urn.make_entity_type_urn("dataset")], if entity_types
else [Urn.make_entity_type_urn("dataset")]
),
cardinality=cardinality, cardinality=cardinality,
allowedValues=allowed_values, allowedValues=allowed_values,
) )
@ -137,7 +139,7 @@ def create_property_definition(
def attach_property_to_entity( def attach_property_to_entity(
urn: str, urn: str,
property_name: str, property_name: str,
property_value: Union[str, float, List[str | float]], property_value: Union[str, float, List[Union[str, float]]],
graph: DataHubGraph, graph: DataHubGraph,
namespace: str = default_namespace, namespace: str = default_namespace,
): ):