[elbe-devel] [PATCH 14/19] test_xml: use test parameter helpers

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Mar 19 08:47:43 CET 2024


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

diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index c9f768c00b0e..16c80206d4d1 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -2,28 +2,19 @@
 # SPDX-License-Identifier: GPL-3.0-or-later
 # SPDX-FileCopyrightText: 2020 Linutronix GmbH
 
-import os
 import subprocess
 
-from elbepack.directories import elbe_dir, run_elbe
+from elbepack.directories import run_elbe
+from elbepack.tests import parametrize_xml_test_files, xml_test_files
 
 import pytest
 
 
-def _test_cases(prefix):
-    return [
-        os.path.join(elbe_dir, 'tests', fname)
-        for fname
-        in os.listdir(os.path.join(elbe_dir, 'tests'))
-        if fname.startswith(prefix) and fname.endswith('.xml')
-    ]
-
-
 def _delete_project(uuid):
     run_elbe(['control', 'del_project', uuid])
 
 
- at pytest.fixture(scope='module', params=_test_cases('simple'))
+ at pytest.fixture(scope='module', params=xml_test_files('simple'), ids=lambda f: f.name)
 def simple_build(request, tmp_path_factory):
     build_dir = tmp_path_factory.mktemp('build_dir')
     prj = build_dir / 'uuid.prj'
@@ -56,7 +47,7 @@ def test_simple_build(simple_build, check_build):
 
 
 @pytest.mark.slow
- at pytest.mark.parametrize('xml', _test_cases('pbuilder'))
+ at parametrize_xml_test_files('xml', 'pbuilder')
 def test_pbuilder_build(xml, tmp_path, request):
     build_dir = tmp_path
     prj = build_dir / 'uuid.prj'

-- 
2.44.0



More information about the elbe-devel mailing list