[elbe-devel] [PATCH 06/10] elbepack: test_preproc; switch to pytest APIs

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Mar 11 18:02:59 CET 2024


Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/tests/test_preproc.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
index bde60509b9ea..cc807836628a 100644
--- a/elbepack/tests/test_preproc.py
+++ b/elbepack/tests/test_preproc.py
@@ -5,20 +5,21 @@
 import os
 import sys
 
-from elbepack.commands.test import ElbeTestCase, ElbeTestException, system
+from elbepack.commands.test import system
 from elbepack.directories import elbe_dir, elbe_exe
 
+import pytest
 
-class TestPreproc(ElbeTestCase):
-    def test_preproc(self):
-        for param in [os.path.join(elbe_dir, 'tests', fname)
-                      for fname
-                      in os.listdir(os.path.join(elbe_dir, 'tests'))
-                      if fname.startswith('preproc') and fname.endswith('.xml')]:
 
-            with self.subTest(file=param):
-                try:
-                    system(f'{sys.executable} {elbe_exe} preprocess "{param}"')
-                except ElbeTestException as e:
-                    self.stdout = e.out
-                    raise
+def _test_cases():
+    return [
+        os.path.join(elbe_dir, 'tests', fname)
+        for fname
+        in os.listdir(os.path.join(elbe_dir, 'tests'))
+        if fname.startswith('preproc') and fname.endswith('.xml')
+    ]
+
+
+ at pytest.mark.parametrize('f', _test_cases())
+def test_preproc(f):
+    system(f'{sys.executable} {elbe_exe} preprocess "{f}"')

-- 
2.44.0



More information about the elbe-devel mailing list