File: 0001-tests-skip-call.patch

package info (click to toggle)
translate-toolkit 3.15.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,320 kB
  • sloc: python: 64,041; sh: 1,406; makefile: 185; xml: 48
file content (64 lines) | stat: -rw-r--r-- 2,560 bytes parent folder | download
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
From: Stuart Prescott <stuart@debian.org>
Date: Fri, 14 Mar 2025 23:52:43 +1100
Subject: Allow tests of command-line tools to be skipped

The test suite has no clean separation between testing the command line tools
and testing the classes; the packaging will end up separating them, making
in-place testing of only the modules difficult. This patch adds an environment
variable to disable command-line tools being called from tests.
---
 tests/translate/storage/test_mo.py                | 3 +++
 tests/xliff_conformance/test_xliff_conformance.py | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/tests/translate/storage/test_mo.py b/tests/translate/storage/test_mo.py
index 9f9a685..1d455dc 100644
--- a/tests/translate/storage/test_mo.py
+++ b/tests/translate/storage/test_mo.py
@@ -8,6 +8,7 @@ from translate.tools import pocompile
 
 from . import test_base
 
+import pytest
 
 class TestMOUnit(test_base.TestTranslationUnit):
     UnitClass = mo.mounit
@@ -505,6 +506,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..420f0c8 100644
--- a/tests/xliff_conformance/test_xliff_conformance.py
+++ b/tests/xliff_conformance/test_xliff_conformance.py
@@ -22,6 +22,7 @@ from subprocess import call
 import pytest
 from lxml import etree
 
+import pytest
 
 @pytest.fixture(autouse=True, scope="module")
 def change_test_dir(request):
@@ -45,6 +46,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 +55,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