summaryrefslogtreecommitdiff
path: root/dts/framework/test_suite.py
diff options
context:
space:
mode:
authorJuraj Linkeš <[email protected]>2023-12-04 11:24:09 +0100
committerThomas Monjalon <[email protected]>2023-12-21 12:34:04 +0100
commit840b1e01af3391ecda5124322109f2d34b7d6d86 (patch)
tree68f1e336c7929ef9dc2f0648a98952917cabeb0c /dts/framework/test_suite.py
parent97433132c2edda70ff69843b8f9273853cac984c (diff)
dts: adjust code for doc generation
The standard Python tool for generating API documentation, Sphinx, imports modules one-by-one when generating the documentation. This requires code changes: * properly guarding argument parsing in the if __name__ == '__main__' block, * the logger used by DTS runner underwent the same treatment so that it doesn't create log files outside of a DTS run, * however, DTS uses the arguments to construct an object holding global variables. The defaults for the global variables needed to be moved from argument parsing elsewhere, * importing the remote_session module from framework resulted in circular imports because of one module trying to import another module. This is fixed by reorganizing the code, * some code reorganization was done because the resulting structure makes more sense, improving documentation clarity. The are some other changes which are documentation related: * added missing type annotation so they appear in the generated docs, * reordered arguments in some methods, * removed superfluous arguments and attributes, * change private functions/methods/attributes to private and vice-versa. The above all appear in the generated documentation and the with them, the documentation is improved. Signed-off-by: Juraj Linkeš <[email protected]>
Diffstat (limited to 'dts/framework/test_suite.py')
-rw-r--r--dts/framework/test_suite.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
index 4a7907ec33..f9e66e814a 100644
--- a/dts/framework/test_suite.py
+++ b/dts/framework/test_suite.py
@@ -11,7 +11,7 @@ import inspect
import re
from ipaddress import IPv4Interface, IPv6Interface, ip_interface
from types import MethodType
-from typing import Union
+from typing import Any, Union
from scapy.layers.inet import IP # type: ignore[import]
from scapy.layers.l2 import Ether # type: ignore[import]
@@ -26,8 +26,7 @@ from .exception import (
from .logger import DTSLOG, getLogger
from .settings import SETTINGS
from .test_result import BuildTargetResult, Result, TestCaseResult, TestSuiteResult
-from .testbed_model import SutNode, TGNode
-from .testbed_model.hw.port import Port, PortLink
+from .testbed_model import Port, PortLink, SutNode, TGNode
from .utils import get_packet_summaries
@@ -426,7 +425,7 @@ class TestSuite(object):
def get_test_suites(testsuite_module_path: str) -> list[type[TestSuite]]:
- def is_test_suite(object) -> bool:
+ def is_test_suite(object: Any) -> bool:
try:
if issubclass(object, TestSuite) and object is not TestSuite:
return True