1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
From: Stuart Prescott <stuart@debian.org>
Date: Sun, 28 Sep 2025 17:22:53 +1000
Subject: Allow command-line tests to be skipped
---
tests/translate/storage/test_mo.py | 5 ++++-
tests/xliff_conformance/test_xliff_conformance.py | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/translate/storage/test_mo.py b/tests/translate/storage/test_mo.py
index 8d2729e..c6ce6aa 100644
--- a/tests/translate/storage/test_mo.py
+++ b/tests/translate/storage/test_mo.py
@@ -3,6 +3,8 @@ import subprocess
import sys
from io import BytesIO
+import pytest
+
from translate.storage import factory, mo
from translate.tools import pocompile
@@ -11,7 +13,6 @@ from . import test_base
MO_BIG_ENDIAN = b"\x95\x04\x12\xde\x00\x00\x00\x2a\x00\x00\x00\x02\x00\x00\x00\x1c\x00\x00\x00,\x00\x00\x00\x05\x00\x00\x00<\x00\x00\x00\x06\x00\x00\x00P\x00\x00\x00\x07\x00\x00\x00W\x00\x00\x00\x03\x00\x00\x00_\x00\x00\x00\x06\x00\x00\x00c\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02simple\x00unicode\x00Een\x00\xe2\x80\xa0wee\x00"
MO_LITTLE_ENDIAN = b"\xde\x12\x04\x95\x2a\x00\x00\x00\x02\x00\x00\x00\x1c\x00\x00\x00,\x00\x00\x00\x05\x00\x00\x00<\x00\x00\x00\x06\x00\x00\x00P\x00\x00\x00\x07\x00\x00\x00W\x00\x00\x00\x03\x00\x00\x00_\x00\x00\x00\x06\x00\x00\x00c\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00simple\x00unicode\x00Een\x00\xe2\x80\xa0wee\x00"
-
class TestMOUnit(test_base.TestTranslationUnit):
UnitClass = mo.mounit
@@ -508,6 +509,8 @@ class TestMOFile(test_base.TestTranslationStore):
assert len(newstore.units) == 1
assert newstore.units[0].getcontext(), "context"
+ @pytest.mark.skipif("TTKIT_SKIP_COMMANDS" in os.environ,
+ reason="Skip testing command line tools")
def test_output(self):
assert len(posources) == len(mosources), "Missing MO rendering for PO sources"
for i, posource in enumerate(posources):
diff --git a/tests/xliff_conformance/test_xliff_conformance.py b/tests/xliff_conformance/test_xliff_conformance.py
index 1a18d18..0e93639 100644
--- a/tests/xliff_conformance/test_xliff_conformance.py
+++ b/tests/xliff_conformance/test_xliff_conformance.py
@@ -22,7 +22,6 @@ from subprocess import call
import pytest
from lxml import etree
-
@pytest.fixture(autouse=True, scope="module")
def change_test_dir(request):
os.chdir(request.fspath.dirname)
@@ -45,6 +44,8 @@ def find_files(base, check_ext):
yield fullpath
+@pytest.mark.skipif("TTKIT_SKIP_COMMANDS" in os.environ,
+ reason="Skip testing command line tools")
def test_open_office_to_xliff(xmllint):
assert call(["oo2xliff", "en-US.sdf", "-l", "fr", "fr"]) == 0
for filepath in find_files("fr", ".xlf"):
@@ -52,6 +53,8 @@ def test_open_office_to_xliff(xmllint):
cleardir("fr")
+@pytest.mark.skipif("TTKIT_SKIP_COMMANDS" in os.environ,
+ reason="Skip testing command line tools")
def test_po_to_xliff(xmllint):
OUTPUT = "af-pootle.xlf"
assert call(["po2xliff", "af-pootle.po", OUTPUT]) == 0
|