rusackas opened a new pull request, #40233:
URL: https://github.com/apache/superset/pull/40233
### SUMMARY
This is a **test-only PR** opened as a TDD-style validation of issue #28331.
#28331 (filed 2024-05) reports that backend `humanize`-formatted strings
(e.g. the last-modified label on the chart editor header) always render in
English, ignoring the user's locale setting. The relevant code path is
`_format_time_humanized` in `superset/models/helpers.py:632-645`, which should
call `humanize.i18n.activate(locale)` for non-English locales.
This PR adds two regression tests:
1. **`test_format_time_humanized_activates_non_english_locale`** — patches
`get_locale` to return `"es"` and asserts that `humanize.i18n.activate("es")`
is called and `deactivate` follows.
2. **`test_format_time_humanized_skips_activation_for_english`** — pins the
English fast-path so a future refactor doesn't regress the perf shortcut.
### How to interpret CI
- **CI green** → locale activation is correctly wired; merging closes #28331
and locks in the regression guard.
- **CI red** → `_format_time_humanized` isn't honoring the locale. Likely
region: `superset/models/helpers.py:632`.
### TESTING INSTRUCTIONS
\`\`\`bash
pytest
tests/unit_tests/models/helpers_test.py::test_format_time_humanized_activates_non_english_locale
-v
pytest
tests/unit_tests/models/helpers_test.py::test_format_time_humanized_skips_activation_for_english
-v
\`\`\`
### ADDITIONAL INFORMATION
- [x] Has associated issue: closes #28331
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]