Merge pull request #605 from cjmayo/test_po

Use existing test_po.py only
This commit is contained in:
Chris Mayo 2022-01-19 19:39:34 +00:00 committed by GitHub
commit ff7e157a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 18 deletions

View file

@ -28,6 +28,7 @@ jobs:
steps:
- name: Install OS dependencies
run: |
sudo apt update
sudo apt install -y clamav-daemon geoip-database libgeoip-dev gettext
- name: Download the ClamAV signature database
@ -149,17 +150,3 @@ jobs:
- name: Run ${{ matrix.toxenv }}
run: python -m tox -e ${{ matrix.toxenv }}
translations:
name: Check Translations
runs-on: ubuntu-latest
steps:
- name: Git clone
uses: actions/checkout@v2
- name: Install dependency
run: sudo apt install -y gettext
- name: Compile translations
run: for po in po/*.po; do msgfmt -cv --statistics -o - ${po} >/dev/null; done

View file

@ -19,7 +19,7 @@ Test gettext .po files.
"""
import unittest
import os
import subprocess
import glob
from tests import need_msgfmt, need_posix
@ -33,7 +33,7 @@ def get_pofiles():
if pofiles is None:
pofiles = []
pofiles.extend(glob.glob("po/*.po"))
pofiles.extend(glob.glob("doc/*.po"))
pofiles.extend(glob.glob("doc/i18n/locales/**/*.po", recursive=True))
if not pofiles:
raise Exception("No .po files found")
return pofiles
@ -47,8 +47,10 @@ class TestPo(unittest.TestCase):
def test_pos(self):
"""Test .po files syntax."""
for f in get_pofiles():
ret = os.system("msgfmt -c -o - %s > /dev/null" % f)
self.assertEqual(ret, 0, msg="PO-file syntax error in %r" % f)
cp = subprocess.run(["msgfmt", "-c", "-o", "-", f], capture_output=True)
self.assertEqual(
cp.returncode, 0,
msg=f"PO-file syntax error in {f!r}: {str(cp.stderr, 'utf-8')}")
class TestGTranslator(unittest.TestCase):