Skip to content

Commit bd4ff87

Browse files
committed
tests: improve output of "pytest -v"
1 parent cf66993 commit bd4ff87

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

dev_tools/tests/test_docs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ..docs import nxdl_indices
77
from ..globals.directories import get_xsd_file
88
from ..nxdl import iter_definitions
9+
from .utils import pytest_path_param_id
910

1011

1112
@pytest.fixture(scope="module")
@@ -26,17 +27,23 @@ def anchor_registry_write(tmpdir_factory):
2627
reg.write()
2728

2829

29-
@pytest.mark.parametrize("nxdl_file", list(iter_definitions()))
30+
@pytest.mark.parametrize(
31+
"nxdl_file", list(iter_definitions()), ids=pytest_path_param_id
32+
)
3033
def test_nxdl_generate_doc(nxdl_file, doc_generator):
3134
assert doc_generator(nxdl_file)
3235

3336

34-
@pytest.mark.parametrize("nxdl_file", list(iter_definitions()))
37+
@pytest.mark.parametrize(
38+
"nxdl_file", list(iter_definitions()), ids=pytest_path_param_id
39+
)
3540
def test_nxdl_anchor_list(nxdl_file, doc_generator, anchor_registry):
3641
assert doc_generator(nxdl_file, anchor_registry=anchor_registry)
3742

3843

39-
@pytest.mark.parametrize("nxdl_file", list(iter_definitions()))
44+
@pytest.mark.parametrize(
45+
"nxdl_file", list(iter_definitions()), ids=pytest_path_param_id
46+
)
4047
def test_nxdl_anchor_write_list(nxdl_file, doc_generator, anchor_registry_write):
4148
assert doc_generator(nxdl_file, anchor_registry=anchor_registry_write)
4249

dev_tools/tests/test_nxdl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ..nxdl import iter_definitions
55
from ..nxdl import nxdl_schema
66
from ..nxdl import validate_definition
7+
from .utils import pytest_path_param_id
78

89

910
def test_iter_definitions():
@@ -25,6 +26,8 @@ def xml_schema():
2526
return nxdl_schema()
2627

2728

28-
@pytest.mark.parametrize("nxdl_file", list(iter_definitions()))
29+
@pytest.mark.parametrize(
30+
"nxdl_file", list(iter_definitions()), ids=pytest_path_param_id
31+
)
2932
def test_nxdl_syntax(nxdl_file, xml_schema):
3033
validate_definition(nxdl_file, xml_schema)

dev_tools/tests/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pathlib import Path
2+
3+
4+
def pytest_path_param_id(path: Path) -> str:
5+
return f"{path.parent.name}/{path.name}"

0 commit comments

Comments
 (0)