Skip to content

Comments

fix: pydantic >= 2.0 and enforce required metadata fields and move test data to fixture#30

Closed
sgomezvillamor wants to merge 1 commit intomainfrom
fix/metadata-model-and-test-collection
Closed

fix: pydantic >= 2.0 and enforce required metadata fields and move test data to fixture#30
sgomezvillamor wants to merge 1 commit intomainfrom
fix/metadata-model-and-test-collection

Conversation

@sgomezvillamor
Copy link

@sgomezvillamor sgomezvillamor commented Nov 26, 2025

Summary

Bump pydantic >= 2.0

Additionally, fixed mypy type inconsistencies and pytest collection hanging.

Changes

  • Metadata model fix: Added assertions to validate required fields exist in meta_info
    • Option 1: Make fields Optional[str] ❌
    • Option 2: Keep fields as required str and fix post_init ✅ (chosen to avoid breaking changes)
  • Test fixture refactoring: Moved expensive data loading from module-level to session-scoped pytest fixture
    • Prevents pytest from hanging during test collection
    • Data is loaded once when tests actually run, not during import

Testing

  • mypy passes without errors
  • pytest collection is now fast (no hanging)

- Add assertions in Metadata.__post_init__ to validate required fields
- Change Metadata fields from Optional[str] to str (avoid breaking change)
- Move module-level test data loading to session-scoped pytest fixture
- Fix pytest hanging during collection phase
@sgomezvillamor sgomezvillamor changed the title fix: enforce required metadata fields and move test data to fixture fix: pydantic >= 2.0 and enforce required metadata fields and move test data to fixture Nov 26, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.71%. Comparing base (233a4dc) to head (2cd8792).

Additional details and impacted files
Files with missing lines Coverage Δ
...ub-classify/src/datahub_classify/helper_classes.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 233a4dc...2cd8792. Read the comment docs.

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

@sgomezvillamor
Copy link
Author

not needed

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.

2 participants