From bd4ff87cf5deae653ff90994053a17c89951dd2b Mon Sep 17 00:00:00 2001 From: woutdenolf Date: Sat, 27 Jun 2026 11:32:43 +0200 Subject: [PATCH] tests: improve output of "pytest -v" --- dev_tools/tests/test_docs.py | 13 ++++++++++--- dev_tools/tests/test_nxdl.py | 5 ++++- dev_tools/tests/utils.py | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 dev_tools/tests/utils.py diff --git a/dev_tools/tests/test_docs.py b/dev_tools/tests/test_docs.py index 01288d3227..e38f4ead3f 100644 --- a/dev_tools/tests/test_docs.py +++ b/dev_tools/tests/test_docs.py @@ -6,6 +6,7 @@ from ..docs import nxdl_indices from ..globals.directories import get_xsd_file from ..nxdl import iter_definitions +from .utils import pytest_path_param_id @pytest.fixture(scope="module") @@ -26,17 +27,23 @@ def anchor_registry_write(tmpdir_factory): reg.write() -@pytest.mark.parametrize("nxdl_file", list(iter_definitions())) +@pytest.mark.parametrize( + "nxdl_file", list(iter_definitions()), ids=pytest_path_param_id +) def test_nxdl_generate_doc(nxdl_file, doc_generator): assert doc_generator(nxdl_file) -@pytest.mark.parametrize("nxdl_file", list(iter_definitions())) +@pytest.mark.parametrize( + "nxdl_file", list(iter_definitions()), ids=pytest_path_param_id +) def test_nxdl_anchor_list(nxdl_file, doc_generator, anchor_registry): assert doc_generator(nxdl_file, anchor_registry=anchor_registry) -@pytest.mark.parametrize("nxdl_file", list(iter_definitions())) +@pytest.mark.parametrize( + "nxdl_file", list(iter_definitions()), ids=pytest_path_param_id +) def test_nxdl_anchor_write_list(nxdl_file, doc_generator, anchor_registry_write): assert doc_generator(nxdl_file, anchor_registry=anchor_registry_write) diff --git a/dev_tools/tests/test_nxdl.py b/dev_tools/tests/test_nxdl.py index bdeafe124a..ea4e4e5d1e 100644 --- a/dev_tools/tests/test_nxdl.py +++ b/dev_tools/tests/test_nxdl.py @@ -4,6 +4,7 @@ from ..nxdl import iter_definitions from ..nxdl import nxdl_schema from ..nxdl import validate_definition +from .utils import pytest_path_param_id def test_iter_definitions(): @@ -25,6 +26,8 @@ def xml_schema(): return nxdl_schema() -@pytest.mark.parametrize("nxdl_file", list(iter_definitions())) +@pytest.mark.parametrize( + "nxdl_file", list(iter_definitions()), ids=pytest_path_param_id +) def test_nxdl_syntax(nxdl_file, xml_schema): validate_definition(nxdl_file, xml_schema) diff --git a/dev_tools/tests/utils.py b/dev_tools/tests/utils.py new file mode 100644 index 0000000000..753888f88c --- /dev/null +++ b/dev_tools/tests/utils.py @@ -0,0 +1,5 @@ +from pathlib import Path + + +def pytest_path_param_id(path: Path) -> str: + return f"{path.parent.name}/{path.name}"