zonemaster-engine
zonemaster-engine copied to clipboard
Rocky Linux 9.3: unit tests fail because of PO file formatting
PR #1305 changed the formatting of the msgstrs in the PO files in order to make continous integration happy. Otherwise, the tests in t/po-files.t
do not pass.
But this change breaks the unit tests when I run them on Rocky Linux 9.3:
$ prove -l t/po-files.t
t/po-files.t .. 3/?
# Failed test 'all files are tidied (if not run "make tidy-po")'
# at t/po-files.t line 63.
# got: '23 23 share/fr.po
# 10 10 share/nb.po
# 4 4 share/sv.po
# '
# expected: ''
Reverting commit 7f6495d makes the t/po-files.t
pass again:
$ git revert --no-commit 7f6495d
$ prove -l t/po-files.t
t/po-files.t .. ok
All tests successful.
Files=1, Tests=4, 2 wallclock secs ( 0.03 usr 0.04 sys + 1.56 cusr 0.35 csys = 1.98 CPU)
Result: PASS
My comment on PR #1305 suggests that the change might have been due to a different line-breaking algorithm introduced somewhere between gettext-0.19 and 0.21. This turns out not to be quite true, because the version of gettext on my Rocky Linux system is also version 0.21. Either an Ubuntu-supplied patch changed the line-breaking algorithm, or something else is at play.
One possible course of action is to enable this test only in CI environments and disable it anywhere else. Ensuring that PO files are formatted in a consistent way when changes are committed to them is one thing. But in any other situations, unit tests should fail if and only if something about the end user’s environment may prevent the package from operating correctly (e.g. due to unforeseen platform differences); formatting of PO files is not one of those cases.
The exact same thing happens when I run unit tests on Zonemaster::CLI.
One possible course of action is to enable this test only in CI environments and disable it anywhere else. Ensuring that PO files are formatted in a consistent way when changes are committed to them is one thing. But in any other situations, unit tests should fail if and only if something about the end user’s environment may prevent the package from operating correctly (e.g. due to unforeseen platform differences); formatting of PO files is not one of those cases.
I have run into that problem too on FreeBSD. I cannot remember if it is still there.
This is only a problem in CI since the PO files are not included in the distribution file. The t/po-files.t
file is not in MANIFEST but in MANIFEST.SKIP.
But it is a problem if you cannot format the PO file that you add in your PR so that CI accepts it.
The exact same thing happens when I run unit tests on Zonemaster::CLI.
po-files.t
is not in MANIFEST on CLI either.