Skip to content

Commit 574dcd0

Browse files
Extra test for artifact listing (#2715)
* extra test for artifacts listing * return to legacy format --------- Co-authored-by: Safoine El Khabich <[email protected]>
1 parent 5659da8 commit 574dcd0

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

tests/integration/functional/zen_stores/test_zen_store.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,6 +2966,40 @@ def test_list_unused_artifacts():
29662966
assert artifact_versions.total == num_unused_artifact_versions_before
29672967

29682968

2969+
def test_list_custom_named_artifacts():
2970+
"""Tests listing with `has_custom_name=True` only returns custom named artifacts with proper filtering."""
2971+
client = Client()
2972+
store = client.zen_store
2973+
2974+
num_artifact_versions_before = store.list_artifact_versions(
2975+
ArtifactVersionFilter()
2976+
).total
2977+
num_matching_named_before = store.list_artifact_versions(
2978+
ArtifactVersionFilter(
2979+
has_custom_name=True, name="contains:test_step_output"
2980+
)
2981+
).total
2982+
num_runs = 1
2983+
2984+
with PipelineRunContext(num_runs):
2985+
artifact_versions = store.list_artifact_versions(
2986+
ArtifactVersionFilter()
2987+
)
2988+
assert (
2989+
artifact_versions.total
2990+
== num_artifact_versions_before + num_runs * 2
2991+
)
2992+
2993+
artifact_versions = store.list_artifact_versions(
2994+
ArtifactVersionFilter(
2995+
has_custom_name=True, name="contains:test_step_output"
2996+
)
2997+
)
2998+
assert (
2999+
artifact_versions.total - num_matching_named_before == num_runs * 2
3000+
)
3001+
3002+
29693003
def test_artifacts_are_not_deleted_with_run(clean_client: "Client"):
29703004
"""Tests listing with `unused=True` only returns unused artifacts."""
29713005
store = clean_client.zen_store

tests/integration/functional/zen_stores/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar
1818

1919
from pydantic import BaseModel, Field, SecretStr
20+
from typing_extensions import Annotated
2021

2122
from tests.integration.functional.utils import sample_name
2223
from zenml import (
@@ -104,13 +105,15 @@
104105

105106

106107
@step
107-
def constant_int_output_test_step() -> int:
108+
def constant_int_output_test_step() -> Annotated[int, "test_step_output"]:
108109
logging.info("log")
109110
return 7
110111

111112

112113
@step
113-
def int_plus_one_test_step(input: int) -> int:
114+
def int_plus_one_test_step(
115+
input: int,
116+
) -> Annotated[int, "test_step_output_plus_one"]:
114117
return input + 1
115118

116119

0 commit comments

Comments
 (0)