Skip to content

Commit 6ab0d27

Browse files
committed
Dpdk: annotation fixes for mypy
1 parent 6572cb6 commit 6ab0d27

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

microsoft/testsuites/dpdk/dpdkutil.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ class NicType(Enum):
11271127

11281128

11291129
# Short name for nic types
1130-
NIC_SHORT_NAMES = {
1130+
NIC_SHORT_NAMES: Dict[NicType, str] = {
11311131
NicType.CX3: "cx3",
11321132
NicType.CX4: "cx4",
11331133
NicType.CX5: "cx5",
@@ -1150,13 +1150,12 @@ def get_node_nic_short_name(node: Node) -> str:
11501150
short_names = map(lambda x: x.value, non_mana_nics)
11511151
known_nic_types = ",".join(short_names)
11521152
found_nic_types = ",".join(map(str, [x.device_id for x in devices]))
1153-
node.log.debug(
1153+
# assert, this will be caught in annotate_dpdk_test_result
1154+
# and logged, rather than failing the test.
1155+
raise AssertionError(
11541156
"Unknown NIC hardware was detected during DPDK test case. "
11551157
f"Expected one of: {known_nic_types}. Found {found_nic_types}. "
11561158
)
1157-
# this is just a function for annotating a result, so don't assert
1158-
# if there's
1159-
return found_nic_types
11601159

11611160

11621161
def _format_version_str(version: VersionInfo) -> str:
@@ -1178,19 +1177,19 @@ def annotate_dpdk_test_result(
11781177
test_result.information["dpdk_version"] = _format_version_str(dpdk_version)
11791178
log.debug(f"Adding dpdk version: {dpdk_version}")
11801179
except AssertionError as err:
1181-
test_kit.node.log.debug(f"Could not fetch DPDK version info: {str(err)}")
1180+
log.debug(f"Could not fetch DPDK version info: {str(err)}")
11821181
try:
11831182
rdma_version = test_kit.rdma_core.get_installed_version()
11841183
test_result.information["rdma_version"] = _format_version_str(rdma_version)
11851184
log.debug(f"Adding rdma version: {rdma_version}")
11861185
except AssertionError as err:
1187-
test_kit.node.log.debug(f"Could not fetch RDMA version info: {str(err)}")
1186+
log.debug(f"Could not fetch RDMA version info: {str(err)}")
11881187
try:
11891188
nic_hw = get_node_nic_short_name(test_kit.node)
11901189
test_result.information["nic_hw"] = nic_hw
11911190
log.debug(f"Adding nic version: {nic_hw}")
11921191
except AssertionError as err:
1193-
test_kit.node.log.debug(f"Could not fetch NIC short name: {str(err)}")
1192+
log.debug(f"Could not fetch NIC short name: {str(err)}")
11941193

11951194

11961195
def skip_32bit_test_on_unsupported_distros(os: OperatingSystem) -> None:

0 commit comments

Comments
 (0)