Skip to content

test: run test_model_fields in CI again - #164

Open
matthiasschabel wants to merge 1 commit into
pyapp-kit:mainfrom
matthiasschabel:test/declare-pydantic-compat
Open

matthiasschabel wants to merge 1 commit into
pyapp-kit:mainfrom
matthiasschabel:test/declare-pydantic-compat

Conversation

@matthiasschabel

@matthiasschabel matthiasschabel commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

tests/test_model_fields.py is skipped in all 15 jobs of the CI test matrix, so the pydantic and psygnal tests aren't running.

  • The module imports BaseModel from pydantic_compat, which was never a declared test dependency. It came in through napari's app-model, which dropped it in 0.5.0.
  • That import shares a try/except ImportError with import pydantic, so the module skips with "pydantic not installed" even though pydantic is installed.

This PR adds pydantic-compat to the test_thirdparty group and skips only when pydantic itself is missing, so a missing pydantic_compat now fails collection instead of skipping. The test_min job still skips the module.

I kept the shim rather than switching to pydantic.BaseModel, because test_pydantic_validate relies on it for .json() and the class-based Config, which warn under pydantic 2 and fail with filterwarnings = ["error"].

The 5 lines codecov/patch reports as missing on #155 are the pydantic serializer, which is only tested in this file.

🤖 Generated with Claude Code

tests/test_model_fields.py imports BaseModel from pydantic_compat, which was
never a declared test dependency. It arrived through napari's app-model until
app-model 0.5.0 dropped it, and since then the module-level except ImportError
has skipped the whole file in every CI job, reporting "pydantic not installed"
while pydantic was installed.

Declare pydantic-compat in the test_thirdparty group, and skip only when
pydantic itself is missing, so a missing pydantic_compat fails collection
instead of skipping silently.

Reviewed-By: Codex (gpt-6-astra, reasoning effort medium)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.74%. Comparing base (87b7250) to head (ad579d1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #164      +/-   ##
==========================================
+ Coverage   94.62%   95.74%   +1.12%     
==========================================
  Files         168      168              
  Lines        2231     2231              
==========================================
+ Hits         2111     2136      +25     
+ Misses        120       95      -25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matthiasschabel

matthiasschabel commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@tlambert03 I don't understand the pydantic/CI stuff well enough to really carefully review this - it's mostly Claude's work reviewed by Codex...but it is pretty small, appears to fix the issue, and seems to make sense.

This branch has not been deployed

No deployments
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.

1 participant