Skip to content

Commit 3df9e21

Browse files
committed
Fix pytest 9.1 test deprecations
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alex Iannicelli <atiannicelli@gmail.com>
1 parent 777a4ea commit 3df9e21

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

packages/overture-schema-codegen/tests/test_integration_real_models.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -234,28 +234,27 @@ def test_segment_common_base_is_base_model(self, segment_spec: UnionSpec) -> Non
234234
assert "id" in segment_spec.common_base.model_fields
235235

236236

237-
class TestPydanticTypePages:
238-
"""End-to-end: pipeline produces pages for referenced Pydantic built-in types."""
237+
@pytest.fixture(scope="module")
238+
def pages() -> list:
239+
"""Generate all pages from real discovered models."""
240+
models = discover_models()
241+
feature_specs: list[FeatureSpec] = []
242+
for key, entry in models.items():
243+
if is_model_class(entry):
244+
feature_specs.append(extract_model(entry, entry_point=key.entry_point))
245+
elif is_union_alias(entry):
246+
feature_specs.append(
247+
extract_union(
248+
entry_point_class(key.entry_point),
249+
entry,
250+
entry_point=key.entry_point,
251+
)
252+
)
253+
return generate_markdown_pages(feature_specs, "overture.schema")
239254

240-
_SCHEMA_ROOT = "overture.schema"
241255

242-
@pytest.fixture(scope="class")
243-
def pages(self) -> list:
244-
"""Generate all pages from real discovered models."""
245-
models = discover_models()
246-
feature_specs: list[FeatureSpec] = []
247-
for key, entry in models.items():
248-
if is_model_class(entry):
249-
feature_specs.append(extract_model(entry, entry_point=key.entry_point))
250-
elif is_union_alias(entry):
251-
feature_specs.append(
252-
extract_union(
253-
entry_point_class(key.entry_point),
254-
entry,
255-
entry_point=key.entry_point,
256-
)
257-
)
258-
return generate_markdown_pages(feature_specs, self._SCHEMA_ROOT)
256+
class TestPydanticTypePages:
257+
"""End-to-end: pipeline produces pages for referenced Pydantic built-in types."""
259258

260259
def test_http_url_page_exists(self, pages: list) -> None:
261260
"""Pipeline produces a page for HttpUrl under pydantic/networks/."""

packages/overture-schema-common/tests/scoping/test_scoped.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ class Qux(BaseModel):
142142
pass
143143

144144
@pytest.mark.parametrize(
145-
"scope,required", itertools.product(Scope._top_level_scopes(), (False, True))
145+
"scope,required",
146+
list(itertools.product(Scope._top_level_scopes(), (False, True))),
146147
)
147148
def test_single_scope_top_level(self, scope: Scope, required: bool) -> None:
148149
if required:
@@ -162,7 +163,8 @@ class SingleScoped(BaseModel):
162163
assert field_info.is_required() == required
163164

164165
@pytest.mark.parametrize(
165-
"scope,required", itertools.product(Scope._when_scopes(), (False, True))
166+
"scope,required",
167+
list(itertools.product(Scope._when_scopes(), (False, True))),
166168
)
167169
def test_single_scope_when(self, scope: Scope, required: bool) -> None:
168170
if required:

0 commit comments

Comments
 (0)