Skip to content

Commit

Permalink
added is_singular field to the TestSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaKerman committed Sep 9, 2024
1 parent 4de1a88 commit 07faf26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions elementary/monitor/api/tests/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class TestSchema(BaseModel):
display_name: str
original_path: Optional[str] = None
type: str
is_singular: Optional[bool] = None
test_type: Optional[str] = None
test_sub_type: Optional[str] = None
test_params: dict
Expand Down
9 changes: 9 additions & 0 deletions elementary/monitor/api/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@ def _get_normalized_full_path(
return f"{package_name}/{original_path}"
return original_path

@staticmethod
def _get_is_singular(original_path: Optional[str]) -> Optional[bool]:
return (
(original_path.startswith("tests/") and original_path.endswith(".sql"))
if original_path
else None
)

@classmethod
def _parse_test_db_row(cls, test_db_row: TestDBRowSchema) -> TestSchema:
latest_run_datetime = (
Expand All @@ -467,6 +475,7 @@ def _parse_test_db_row(cls, test_db_row: TestDBRowSchema) -> TestSchema:
display_name=cls._get_display_name(test_db_row.name),
original_path=test_db_row.original_path,
type=test_db_row.type,
is_singular=cls._get_is_singular(test_db_row.original_path),
test_type=test_db_row.test_type,
test_sub_type=test_db_row.test_sub_type,
test_params=test_db_row.test_params,
Expand Down

0 comments on commit 07faf26

Please sign in to comment.