WizardKit/scripts/wk/hw/test.py
2Shirt fc2bb07d11
Track test groups as list instead of a dict
By only including selected tests we can skip checking for the
enabled/disabled status.  This will also simplify the process
of disabling future tests for a disk if a failure is detected.
2022-04-05 14:45:14 -06:00

35 lines
943 B
Python

"""WizardKit: Test object and functions"""
# vim: sts=2 sw=2 ts=2
from dataclasses import dataclass, field
from typing import Any, Callable
@dataclass(slots=True)
class Test:
# pylint: disable=too-many-instance-attributes
"""Object for tracking test specific data."""
dev: Any
label: str
name: str
disabled: bool = field(init=False, default=False)
failed: bool = field(init=False, default=False)
hidden: bool = False
passed: bool = field(init=False, default=False)
report: list[str] = field(init=False, default_factory=list)
status: str = field(init=False, default='Pending')
def set_status(self, status):
"""Update status string."""
if self.disabled:
# Don't change status if disabled
return
self.status = status
@dataclass(slots=True)
class TestGroup:
"""Object for tracking groups of tests."""
name: str
function: Callable
test_objects: list[Test] = field(default_factory=list)