tests: dist: Add xgettext warning check

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-07-12 17:08:10 -04:00
parent 837bbf2bd3
commit e2b1e2d59b

View File

@ -4,6 +4,7 @@
# See the COPYING file in the top-level directory.
import glob
import subprocess
import unittest
import xml.etree.ElementTree as ET
@ -21,7 +22,6 @@ class TestDist(unittest.TestCase):
"""
failures = []
for pofile in glob.glob("po/*.po"):
import subprocess
proc = subprocess.Popen(["msgfmt", "--output-file=/dev/null",
"--check", pofile],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -37,6 +37,26 @@ class TestDist(unittest.TestCase):
raise AssertionError(msg)
def test_validate_pot_strings(self):
"""
Validate that xgettext via `setup.py extract_messages` don't print
any warnings
"""
potfile = "po/virt-manager.pot"
origpot = open(potfile).read()
try:
out = subprocess.check_output(
["./setup.py", "extract_messages"],
stderr=subprocess.STDOUT)
warnings = [l for l in out.decode("utf-8").splitlines()
if "warning:" in l]
if warnings:
raise AssertionError("xgettext has warnings:\n\n%s" %
"\n".join(warnings))
finally:
open(potfile, "w").write(origpot)
def test_ui_minimum_version(self):
"""
Ensure all glade XML files don't _require_ UI bits later than