Skip to content

Commit

Permalink
Fix test_root_validator_allow_reuse_same_field() for all warnings
Browse files Browse the repository at this point in the history
Fix
`tests/test_validators.py::test_root_validator_allow_reuse_same_field`
to assert for both warnings emitted, including the Pydantic V1
deprecation warning.  Starting with pytest 8.0.0 (thanks to the fix for
pytest-dev/pytest#9288), `pytest.warns()` re-emits warnings that weren't
caught by the assertion, effectively causing the default run with
`-Werror` to fail.
  • Loading branch information
mgorny committed Jan 30, 2024
1 parent e43edaa commit 7f54e1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ class Model(BaseModel):


def test_root_validator_allow_reuse_same_field():
with pytest.warns(UserWarning, match='`root_val` overrides an existing Pydantic `@root_validator` decorator'):
with pytest.warns(PydanticDeprecatedSince20), pytest.warns(UserWarning, match='`root_val` overrides an existing Pydantic `@root_validator` decorator'):

class Model(BaseModel):
x: int
Expand Down

0 comments on commit 7f54e1d

Please sign in to comment.