Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix the sorting of tests #808

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/test_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def has_item(self, id: str, classes: Optional[List[str]] = None):
" "
), f"Missing class '{klass}' for {id}. Have: {node.get('class')}"

@property
def name(self):
return self.device.name


def is_autogenerated(svg_filename: Path):
tabletfile = datadir() / svg_filename.name.replace(".svg", ".tablet")
Expand All @@ -81,9 +85,10 @@ def pytest_generate_tests(metafunc):
for d in devices
if d.layout_filename
]
devices = sorted(devices, key=lambda d: d.name)

def filenames(devices: List[SvgDevice]) -> List[str]:
return sorted([Path(d.device.layout_filename).name for d in devices])
return [Path(d.device.layout_filename).name for d in devices]

if "svgdevice" in metafunc.fixturenames:
metafunc.parametrize("svgdevice", devices, ids=filenames(devices))
Expand Down