Update l10n test: check .po files for mandatory metadata fields#3279
Update l10n test: check .po files for mandatory metadata fields#3279arkid15r merged 5 commits intovacanza:devfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 Summary by CodeRabbit
WalkthroughTests now locate PO files from the repository grandparent Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
This reverts commit 8f8de9a.
arkid15r
left a comment
There was a problem hiding this comment.
LGTM
// sorry for the mess -- missed the top level loop.
There was a problem hiding this comment.
🤖 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.
|



Proposed change
Update l10n test: check .po files for mandatory metadata fields.
Type of change
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.