diff options
| author | Juraj Linkeš <[email protected]> | 2024-09-23 17:02:02 +0200 |
|---|---|---|
| committer | Patrick Robb <[email protected]> | 2024-10-11 20:08:12 +0200 |
| commit | 566201aebdda2aa2b290d551b8f01cb329daf428 (patch) | |
| tree | 91eb165b5d2391bbe5cefef400b11abb39be38ab /dts/framework/test_suite.py | |
| parent | b6eb5004460e1e96269a29a54ae70c24611ad4b0 (diff) | |
dts: add mechanism to skip test cases or suites
If a test case is not relevant to the testing environment (such as when
a NIC doesn't support a tested feature), the framework should skip it.
The mechanism is a skeleton without actual logic that would set a test
case or suite to be skipped.
The mechanism uses a protocol to extend test suites and test cases with
additional attributes that track whether the test case or suite should
be skipped the reason for skipping it.
Also update the results module with the new SKIP result.
Signed-off-by: Juraj Linkeš <[email protected]>
Reviewed-by: Dean Marx <[email protected]>
Reviewed-by: Jeremy Spewock <[email protected]>
Reviewed-by: Luca Vizzarro <[email protected]>
Diffstat (limited to 'dts/framework/test_suite.py')
| -rw-r--r-- | dts/framework/test_suite.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 0402d2b614..48175b5a60 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -24,6 +24,7 @@ from scapy.layers.inet import IP # type: ignore[import-untyped] from scapy.layers.l2 import Ether # type: ignore[import-untyped] from scapy.packet import Packet, Padding, raw # type: ignore[import-untyped] +from framework.testbed_model.capability import TestProtocol from framework.testbed_model.port import Port, PortLink from framework.testbed_model.sut_node import SutNode from framework.testbed_model.tg_node import TGNode @@ -36,7 +37,7 @@ from .logger import DTSLogger, get_dts_logger from .utils import get_packet_summaries -class TestSuite: +class TestSuite(TestProtocol): """The base class with building blocks needed by most test cases. * Test suite setup/cleanup methods to override, @@ -542,7 +543,7 @@ class TestCaseType(Enum): PERFORMANCE = auto() -class TestCase(Protocol[TestSuiteMethodType]): +class TestCase(TestProtocol, Protocol[TestSuiteMethodType]): """Definition of the test case type for static type checking purposes. The type is applied to test case functions through a decorator, which casts the decorated @@ -573,6 +574,8 @@ class TestCase(Protocol[TestSuiteMethodType]): def _decorator(func: TestSuiteMethodType) -> type[TestCase]: test_case = cast(type[TestCase], func) + test_case.skip = cls.skip + test_case.skip_reason = cls.skip_reason test_case.test_type = test_case_type return test_case |
