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.
@@ -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'
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/
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
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).
- 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
- GitHub issue: #9025
- Fix PR: https://github.com/pydantic/pydantic/pull/9527
- First fixed release: 1.10.16
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.41
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, Thanks for reporting these. Are you interested in opening another PR to help us fix these issues?”
“@mgorny, No worries. We can take a look after the 2.7 release! Adding this to the 2.8 milestone.”
“Maybe I'll try experimenting a bit later today, if I feel better.”
Failure Signature (Search String)
- def test_config_class_is_deprecated(self):
Error Message
Stack trace
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 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
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
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.
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.
When NOT to Use This Fix
- This fix should not be used if the warnings are still relevant for the tests.
Verify Fix
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
| Version | Status |
|---|---|
| 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.