Skip to content

Commit

Permalink
Fix failing format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw committed Nov 8, 2024
1 parent 9782525 commit 7ee6b89
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test_oss_cloud_api_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
import pytest


PREFECT_V2 = False


@pytest.fixture
def oss_schema():
return load_schema("oss_schema.json")
schema = load_schema("oss_schema.json")
if schema["info"]["version"].startswith("2"):
global PREFECT_V2
PREFECT_V2 = True
return schema


@pytest.fixture
Expand Down Expand Up @@ -252,11 +259,21 @@ def extract_types(d):
return {item.get("type") for item in d["anyOf"] if item.get("type")}
return set()

def extract_format(d):
if "format" in d:
return d["format"]
# in practice, this will have only one format
elif "anyOf" in d:
for option in d["anyOf"]:
if option.get("format"):
return option.get("format")
return None

# TODO: add sorts and filters
prop_gettr = lambda name, d: (
name,
extract_types(d),
d.get("format"),
extract_format(d),
hashable_default(d),
d.get("deprecated"),
)
Expand Down

0 comments on commit 7ee6b89

Please sign in to comment.