Jump to solution
Verify

The Fix

pip install pydantic==1.10.16

Based on closed pydantic/pydantic issue #9025 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -49,7 +49,7 @@ def _create_module_file(code, tmp_path, name): # Don't add URLs during docs tests when printing # Otherwise we'll get version numbers in the URLs that will update frequently - os.environ['PYDANTIC_ERRORS_OMIT_URL'] = 'true' + os.environ['PYDANTIC_ERRORS_INCLUDE_URL'] = 'false'
repro.py
def test_config_class_is_deprecated(self): with pytest.warns( PydanticDeprecatedSince20, match='Support for class-based `config` is deprecated, use ConfigDict instead.' ): E pydantic.warnings.PydanticDeprecatedSince20: BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.16\nWhen NOT to use: This fix should not be used if the warnings are still relevant for the tests.\n\nOption C — Workaround\nall of them by adding `@pytest.mark.filterwarnings` to individual tests. But in some cases, it seems like we are ending up throwing "deep" warnings from implementation of deprecated functions — I suppose I'm going to try changing that to avoid spurious warnings.\nWhen NOT to use: This fix should not be used if the warnings are still relevant for the tests.\n\n

Why This Fix Works in Production

  • Trigger: def test_config_class_is_deprecated(self):
  • Mechanism: Addresses the warnings emitted by pytest 8.x related to deprecated features in Pydantic by ignoring other warnings when checking warnings.
  • Why the fix works: Addresses the warnings emitted by pytest 8.x related to deprecated features in Pydantic by ignoring other warnings when checking warnings. (first fixed release: 1.10.16).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Surfaces as: def test_config_class_is_deprecated(self):

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“I'm afraid I wasn't able to find a good solution here.”
@mgorny · 2024-03-18 · source
“@mgorny, Thanks for reporting these. Are you interested in opening another PR to help us fix these issues?”
@sydney-runkle · 2024-03-17 · source
“@mgorny, No worries. We can take a look after the 2.7 release! Adding this to the 2.8 milestone.”
@sydney-runkle · 2024-03-18 · source
“Maybe I'll try experimenting a bit later today, if I feel better.”
@mgorny · 2024-03-18 · source

Failure Signature (Search String)

  • def test_config_class_is_deprecated(self):

Error Message

Stack trace
error.txt
Error Message ------------- def test_config_class_is_deprecated(self): with pytest.warns( PydanticDeprecatedSince20, match='Support for class-based `config` is deprecated, use ConfigDict instead.' ): E pydantic.warnings.PydanticDeprecatedSince20: BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
Stack trace
error.txt
Error Message ------------- def test_field_include_deprecation(): m = '`include` is deprecated and does nothing. It will be removed, use `exclude` instead' with pytest.warns(PydanticDeprecatedSince20, match=m): E pydantic.warnings.PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'include'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

Minimal Reproduction

repro.py
def test_config_class_is_deprecated(self): with pytest.warns( PydanticDeprecatedSince20, match='Support for class-based `config` is deprecated, use ConfigDict instead.' ): E pydantic.warnings.PydanticDeprecatedSince20: BaseConfig is deprecated. Use the `pydantic.ConfigDict` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

Environment

  • Pydantic: 2

What Broke

Test failures occur due to warnings being treated as errors, causing CI to fail.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.16

When NOT to use: This fix should not be used if the warnings are still relevant for the tests.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option C — Workaround Temporary workaround

all of them by adding `@pytest.mark.filterwarnings` to individual tests. But in some cases, it seems like we are ending up throwing "deep" warnings from implementation of deprecated functions — I suppose I'm going to try changing that to avoid spurious warnings.

When NOT to use: This fix should not be used if the warnings are still relevant for the tests.

Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.

Fix reference: https://github.com/pydantic/pydantic/pull/9527

First fixed release: 1.10.16

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if the warnings are still relevant for the tests.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
1.10.16 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.