Skip to content

test(i18n): run the babel_update.sh msgcat tests on CI - #45247

Merged
hainenber merged 4 commits into
apache:masterfrom
glaterza:fix/i18n-babel-update-test-runs-in-ci
Oct 18, 2026
Merged

hainenber merged 4 commits into
apache:masterfrom
glaterza:fix/i18n-babel-update-test-runs-in-ci

Conversation

@glaterza

@glaterza glaterza commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Updated after review at 482e951e05: the strict check reads CI, not a new SUPERSET_ variable.

Fixes #45245.

#44395 added two tests that run the real msgcat step of scripts/translations/babel_update.sh. They never run on CI, and one of them fails on any machine that has gettext.

  • They skip on CI. Python-Unit does not install gettext, so shutil.which("msgcat") is None and both tests skip. The JUnit report of the Python-Unit run on master at 7aadf35e7d lists both as skipped (https://github.com/apache/superset/actions/runs/38381761342).
  • One fails where gettext exists. The test runs the script with a restricted PATH (/usr/bin:/bin plus stubs). The script calls python on line 77. macOS, Ubuntu 26.04 and Debian 13 have no /usr/bin/python. The trailing-line test fails with line 77: python: command not found.
  • The failing-msgcat test passed for the wrong reason. With the msgcat || exit 1 removed, the script still stopped before pybabel update. It stopped one line later, at the missing python.

This PR changes three things:

  1. Both end-to-end tests put python and python3 shims on the restricted PATH. Each shim runs the interpreter that runs pytest. A shared _stage_script helper replaces the setup that two tests repeated.
  2. Python-Unit and Python-Nightly-Canary install gettext. The step copies the one in superset-translations.yml, with the same pinned action. Like that step, it leaves execute_install_scripts off. The gettext package needs no post-install script.
  3. The two tests call _require_msgcat(). When msgcat is missing, it fails the test if CI is set and skips it otherwise. CI is a controlled environment, so a missing msgcat there means a misconfigured job.

babel_update.sh itself does not change.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Local runs at 482e951e05, on master 139a06eee1.

Before (master's test file, macOS with Homebrew gettext):

FAILED babel_update_test.py::test_the_trailing_line_strip_keeps_the_last_entry_intact
  babel_update.sh: line 77: python: command not found
1 failed, 5 passed

After (this branch):

6 passed

The same runs in Docker, with only python3, python3-pytest and gettext from apt, and CI=true:

Image /usr/bin/python Master's test file This branch
ubuntu:26.04 (the CI runner's release) none 1 failed, 5 passed 6 passed
ubuntu:26.04 with python-is-python3 present not run 6 passed
debian:13 none 1 failed, 5 passed 6 passed

Each test fails when the behavior it guards breaks. Each test stays green on a harmless change:

Change to a copy of babel_update.sh or to the test Test Master This branch
Remove || exit 1 after msgcat failing-msgcat test passes fails
Change it to || exit 2 failing-msgcat test passes passes
Remove the python shims (macOS) trailing-line test n/a fails
Change the script's python call to python3 trailing-line test passes passes

Without msgcat on PATH:

CI=true:    2 failed ("CI is set, but gettext's msgcat is not on PATH: install gettext"), 4 passed
CI unset:   2 skipped ("gettext's msgcat is not installed on this machine"), 4 passed

Python-Unit on this PR at 482e951e05 (https://github.com/apache/superset/actions/runs/38441942670). The JUnit report lists all six babel_update_test.py tests as passed, and none as skipped:

test_normalization_sorts_unwraps_and_drops_locations: passed
test_the_trailing_line_strip_keeps_the_last_entry_intact: passed
Install gettext tools: 1 s (cached)

Python-Nightly-Canary on my fork, with Python 3.13.15, on the first commit of this branch. The workflows at 482e951e05 are identical to that commit.

Install gettext tools   14:45:57 → 14:46:04 (7 s)
tests/unit_tests/scripts/translations/babel_update_test.py ......        [ 73%]
tests/unit_tests/websocket/test_channel.py .............                 [100%]
##[error]The operation was canceled.

All six tests passed, and none skipped. The job then hit its 45-minute timeout, 3 seconds after the last test. The canary on master has the same timeout problem, which #45246 describes.

TESTING INSTRUCTIONS

  1. Install gettext (brew install gettext or apt-get install gettext).
  2. Run pytest tests/unit_tests/scripts/translations/babel_update_test.py. Expect 6 passed. On master, expect the trailing-line test to fail with python: command not found.
  3. Remove gettext from PATH and run the same command with CI=true. Expect 2 failed. Without CI, expect 2 skipped.
  4. In this PR's Python-Unit run, open the junit-results-current artifact. It lists both msgcat tests as passed, not skipped.

All 136 tests in tests/unit_tests/scripts/translations/ pass locally with gettext and CI=true, also with Python-Unit's -n auto --dist loadfile. No other test in tests/ depends on gettext. check_translation_regression_test.py mocks its msgfmt call.

The superset-pr-kit checks skipped three items: toolchain and frontend (no frontend files changed), and catalogs (the translation template did not change).

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

glaterza and others added 3 commits October 13, 2026 10:36
The Python-Unit runner has no gettext, so both msgcat tests skip on CI.
Where msgcat exists, the trailing-line test fails with
`python: command not found`. The script calls `python`, and the
test's restricted `PATH` has none.

Both end-to-end tests now put `python` and `python3` shims on that
`PATH`. Each shim runs the interpreter that runs pytest. A shared
helper stages the script, the stamping script and an empty registry.
Before this change, the failing-msgcat test passed with the msgcat
`|| exit 1` removed. The script stopped one step later, at the
missing `python`.

Python-Unit and the nightly canary install gettext. On CI, a missing
msgcat fails the two tests instead of skipping them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The msgcat tests failed instead of skipping whenever `CI` was set.
GitHub, GitLab, CircleCI and Buildkite all set `CI`. A pipeline outside
apache/superset without gettext would get two new failures.

The tests now call `_require_msgcat()`. It fails only when
`SUPERSET_GETTEXT_STRICT` is set, and skips otherwise. Python-Unit and
Python-Nightly-Canary set it at job level, next to their gettext step.
This copies `SUPERSET_TESTCONTAINERS_STRICT` from apache#43502.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shims wrapped `sys.executable` in double quotes inside a `/bin/sh`
script. A path with a double quote, `$` or a backtick broke the shim.
`shlex.quote` covers every path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 13, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 256e6cb
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ace62eff622247ecc167446
😎 Deploy Preview https://deploy-preview-45247--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; it installs gettext in the two CI jobs and makes missing msgcat fail the relevant tests.
  • The test helpers stage the script in a temporary repository and provide Python interpreter shims, avoiding changes to real translation files.

Assessed commit: 256e6cb7f1b5

@hainenber hainenber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't agree with having an additional arbitrary SUPERSET_ env var only to initiate a test.

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Oct 13, 2026
@glaterza

Copy link
Copy Markdown
Contributor Author

@hainenber Thanks for the review. What would you prefer here?

My proposal is to remove SUPERSET_GETTEXT_STRICT and keep the rest:

  • Python-Unit and Python-Nightly-Canary install gettext.
  • The python and python3 shims let the trailing-line test run where /usr/bin has no python.
  • The two msgcat tests skip when msgcat is missing, as on master.

With gettext installed, both tests run and pass on CI. If a later change removes the gettext step, they skip again without a failure.

Does that work for you, or do you have another approach in mind?

@hainenber

hainenber commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Pretty much as you say, except for one thing: make the unit tests failing if they're ran in CI env, i.e.os.environ.get('CI') to be defined, and msgcat is not installed.

Don't let things skippable in controlled env like CI

Review asked to drop `SUPERSET_GETTEXT_STRICT`. CI is a controlled
environment, so a missing msgcat there must fail the tests, not skip
them. `_require_msgcat()` checks `CI` instead. Both workflows drop the
variable and keep the gettext step. A local run without gettext still
skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@glaterza

Copy link
Copy Markdown
Contributor Author

@hainenber Done in 482e951.

  • SUPERSET_GETTEXT_STRICT is gone from the test and both workflows.
  • _require_msgcat() fails the two msgcat tests when CI is set and msgcat is missing. Without CI, they skip as before.
  • Python-Unit and Python-Nightly-Canary still install gettext, and the python shims stay.

Local results at 482e951:

with msgcat:                6 passed
CI=true, no msgcat:         2 failed ("CI is set, but gettext's msgcat is not on PATH: install gettext"), 4 passed
CI unset, no msgcat:        2 skipped, 4 passed
ubuntu:26.04 and debian:13: 6 passed with CI=true

I updated the PR description to match.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (7aadf35) to head (482e951).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45247      +/-   ##
==========================================
+ Coverage   83.14%   83.23%   +0.09%     
==========================================
  Files        3029     3037       +8     
  Lines      196748   197921    +1173     
  Branches    45967    46128     +161     
==========================================
+ Hits       163580   164741    +1161     
- Misses      29944    29955      +11     
- Partials     3224     3225       +1     
Flag Coverage Δ
hive 35.02% <ø> (-0.02%) ⬇️
mysql 53.09% <ø> (-0.21%) ⬇️
postgres 53.09% <ø> (-0.21%) ⬇️
presto 36.79% <ø> (-0.03%) ⬇️
python 86.86% <ø> (+0.13%) ⬆️
sqlite 52.85% <ø> (-0.20%) ⬇️
unit 80.81% <ø> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@glaterza
glaterza requested a review from hainenber October 13, 2026 22:30

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read through this one and it looks good to me. The python/python3 shims fix the real reason the trailing-line test blew up on macOS and Debian, and staging the registry in _stage_script means the failing-msgcat test now actually reaches msgcat instead of dying one line later.

The SUPERSET_GETTEXT_STRICT var hainenber objected to is gone and the strict path keys off CI as asked. Python-Unit and the canary are the only workflows that run tests/unit_tests, so nothing else with CI set should start failing on a missing msgcat. CI is green.

No inline notes from me.

@hainenber hainenber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for your contribution

@hainenber
hainenber merged commit 4f49d24 into apache:master Oct 18, 2026
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python-Nightly-Canary times out on 6 of 13 runs and files no issue babel_update.sh msgcat tests skip on CI and fail on machines with gettext

3 participants