Skip to content

Conversation

@epmog
Copy link
Contributor

@epmog epmog commented Jun 4, 2025

What was the problem/requirement? (What/Why)

Warnings when running tests:

$ hatch run test
...
==== warnings summary ====
test/openjd/model/_internal/test_create_job.py: 35 warnings
test/openjd/model/test_create_job.py: 20 warnings
test/openjd/model/test_step_dependency_graph.py: 602 warnings
test/openjd/model/v2023_09/test_create.py: 49 warnings
test/openjd/model/test_step_param_space_iter.py: 10 warnings
 openjd-model-for-python/src/openjd/model/_internal/_create_job.py:83: PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
    for field_name in model.model_fields.keys():
...
==== 2154 passed, 716 warnings in 4.18s ====

What was the solution? (How)

Use model.__class__ to access the values

What is the impact of this change?

No more warnings in this package and downstream consumers (ie. openjd-cli)!

How was this change tested?

$ hatch build && hatch run lint && hatch run test
...
==== 2154 passed in 4.29s ====

Was this change documented?

N/A

Is this a breaking change?

N/A

Does this change impact security?

N/A


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@epmog epmog requested a review from a team as a code owner June 4, 2025 22:45
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 4, 2025

@epmog epmog enabled auto-merge (squash) June 4, 2025 22:50
@epmog epmog merged commit eaa17d7 into OpenJobDescription:mainline Jun 4, 2025
19 checks passed
@epmog epmog deleted the fix_pydanticv2_warnings branch June 5, 2025 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants