Skip to content

Update l10n test: check .po files for mandatory metadata fields#3279

Merged
arkid15r merged 5 commits intovacanza:devfrom
KJhellico:upd-l10n-test
Feb 18, 2026
Merged

Update l10n test: check .po files for mandatory metadata fields#3279
arkid15r merged 5 commits intovacanza:devfrom
KJhellico:upd-l10n-test

Conversation

@KJhellico
Copy link
Copy Markdown
Collaborator

Proposed change

Update l10n test: check .po files for mandatory metadata fields.

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉


Summary by CodeRabbit

  • Tests
    • Enforced mandatory metadata for localization PO files to catch missing metadata early.
    • Added clearer validation failures with descriptive messages when metadata is missing.
    • Improved locale discovery to locate translation files more reliably during test runs.
    • Strengthened test flow to handle duplicate-entry cases and validate each PO file consistently.

Walkthrough

Tests now locate PO files from the repository grandparent locale directory, iterate PO files with rglob("*.po"), and assert that each PO file contains a required set of metadata fields; existing per-entry localization checks (obsolete entries, placeholders) remain.

Changes

Cohort / File(s) Summary
Locale test changes
tests/test_l10n.py
Resolve locale_dir via Path(__file__).parents[1] / "holidays" / "locale", iterate PO files with locale_dir.rglob("*.po"), introduce mandatory_fields and assert missing metadata is empty, add metadata validation after PO creation attempt, and move placeholder_re alongside per-entry checks while retaining existing obsolete/placeholder validations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • PPsyrius
  • arkid15r
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding mandatory metadata field validation to the l10n test for .po files.
Description check ✅ Passed The description directly relates to the changeset, explaining the purpose of the update to the l10n test for metadata validation in .po files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6222624) to head (30973c1).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #3279   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          307       307           
  Lines        18373     18373           
  Branches      2352      2352           
=========================================
  Hits         18373     18373           

☔ View full report in Codecov by Sentry.
📢 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.

PPsyrius
PPsyrius previously approved these changes Feb 17, 2026
Copy link
Copy Markdown
Collaborator

@PPsyrius PPsyrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🛠️

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/test_l10n.py`:
- Around line 55-73: The test repeatedly constructs loop-invariant objects
inside the loop: the set mandatory_fields and the regex placeholder_re are
constant across iterations; move their creation out of the loop to avoid
recomputing them each time. Locate the for-loop that iterates over po files in
tests/test_l10n.py, hoist the mandatory_fields set (currently defined as
"Content-Transfer-Encoding", "Content-Type", etc.) to before the loop, and
likewise compile placeholder_re (the regex used around line 104) once before the
loop, then reuse these variables inside the loop and update any references to
them.
- Around line 68-72: The check building missing_fields should be simplified and
made deterministic: replace set(po_file.metadata.keys()) with
set(po_file.metadata) (or just po_file.metadata) when computing missing_fields =
mandatory_fields - set(...), and sort the missing field names in the assertion
message (e.g., use ', '.join(sorted(missing_fields))) so the failure message for
po_path is reproducible; update references around missing_fields,
mandatory_fields, po_file.metadata and po_path accordingly.

Comment thread tests/test_l10n.py Outdated
Comment thread tests/test_l10n.py Outdated
@arkid15r arkid15r enabled auto-merge February 18, 2026 20:04
arkid15r
arkid15r previously approved these changes Feb 18, 2026
Copy link
Copy Markdown
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

// sorry for the mess -- missed the top level loop.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@tests/test_l10n.py`:
- Around line 70-75: In tests/test_l10n.py fix the two nits: construct
missing_fields using set(po_file.metadata) instead of
set(po_file.metadata.keys()) and make the failure message deterministic by
joining sorted(missing_fields) (e.g., f"{', '.join(sorted(missing_fields))}");
reference the variables/members mandatory_fields, missing_fields,
po_file.metadata and po_path when applying the change.

@sonarqubecloud
Copy link
Copy Markdown

@arkid15r arkid15r added this pull request to the merge queue Feb 18, 2026
Merged via the queue into vacanza:dev with commit bacad45 Feb 18, 2026
32 checks passed
@KJhellico KJhellico deleted the upd-l10n-test branch February 18, 2026 20:55
@KJhellico KJhellico mentioned this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants