Skip to content

Commit d4734bd

Browse files
Fix review comments
1 parent 8c84817 commit d4734bd

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

tests/platform_tests/api/test_chassis_fans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,5 @@ def test_is_replaceable(self, platform_api_conn):
233233
for i in range(self.num_fans):
234234
replaceable = fan.is_replaceable(platform_api_conn, i)
235235
if self.expect(replaceable is not None, "Failed to perform is_replaceable for fan {}".format(i)):
236-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan [}".format(i))
236+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan {}".format(i))
237237
self.assert_expectations()

tests/platform_tests/api/test_fan_drawer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ def test_set_fan_drawers_led(self, duthost, localhost, platform_api_conn):
158158
def test_get_position_in_parent(self, platform_api_conn):
159159
for i in range(self.num_fan_drawers):
160160
position = fan_drawer.get_position_in_parent(platform_api_conn, i)
161-
self.expect(position is not None, "Failed to perform get_position_in_parent for fan drawer {}".format(i))
162-
self.expect(isinstance(position, int), "Position value must be an integer value for fan drawer {}".format(i))
161+
if self.expect(position is not None, "Failed to perform get_position_in_parent for fan drawer {}".format(i)):
162+
self.expect(isinstance(position, int), "Position value must be an integer value for fan drawer {}".format(i))
163163
self.assert_expectations()
164164

165165
def test_is_replaceable(self, platform_api_conn):
166166
for i in range(self.num_fan_drawers):
167167
replaceable = fan_drawer.is_replaceable(platform_api_conn, i)
168-
self.expect(replaceable is not None, "Failed to perform is_replaceable for fan drawer {}".format(i))
169-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan drawer [}".format(i))
168+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for fan drawer {}".format(i)):
169+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan drawer {}".format(i))
170170
self.assert_expectations()

tests/platform_tests/api/test_psu.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,22 @@ def test_is_replaceable(self, platform_api_conn):
211211
for psu_id in range(self.num_psus):
212212
replaceable = psu.is_replaceable(platform_api_conn, psu_id)
213213
if self.expect(replaceable is not None, "Failed to perform is_replaceable for psu id {}".format(psu_id)):
214-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for psu id [}".format(psu_id))
214+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for psu id {}".format(psu_id))
215215
self.assert_expectations()
216216

217217
def test_thermals(self, platform_api_conn):
218218
for psu_id in range(self.num_psus):
219219
try:
220220
num_thermals = int(psu.get_num_thermals(platform_api_conn, psu_id))
221221
except Exception:
222-
pytest.fail("num_thermals is not an integer")
222+
pytest.fail("PSU {}: num_thermals is not an integer".format(psu_id))
223223

224224
thermal_list = psu.get_all_thermals(platform_api_conn, psu_id)
225-
pytest_assert(thermal_list is not None, "Failed to retrieve thermals")
226-
pytest_assert(isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect")
225+
pytest_assert(thermal_list is not None, "Failed to retrieve thermals for psu {}".format(psu_id))
226+
pytest_assert(isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect for psu {}".format(psu_id))
227227

228228
for i in range(num_thermals):
229229
thermal = psu.get_thermal(platform_api_conn, psu_id, i)
230-
self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect".format(i))
230+
self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect for psu {}".format(i, psu_id))
231231
self.assert_expectations()
232232

tests/platform_tests/api/test_sfp.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,24 +432,24 @@ def test_get_position_in_parent(self, platform_api_conn):
432432
self.assert_expectations()
433433

434434
def test_is_replaceable(self, platform_api_conn):
435-
for i in range(self.num_sfps):
436-
replaceable = sfp.is_replaceable(platform_api_conn, i)
437-
if self.expect(replaceable is not None, "Failed to perform is_replaceable for sfp {}".format(i)):
438-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for sfp [}".format(i))
435+
for sfp_id in range(self.num_sfps):
436+
replaceable = sfp.is_replaceable(platform_api_conn, sfp_id)
437+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for sfp {}".format(sfp_id)):
438+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for sfp {}".format(sfp_id))
439439
self.assert_expectations()
440440

441441
def test_thermals(self, platform_api_conn):
442-
for i in range(self.num_sfps):
442+
for sfp_id in range(self.num_sfps):
443443
try:
444-
num_thermals = int(sfp.get_num_thermals(platform_api_conn, i))
444+
num_thermals = int(sfp.get_num_thermals(platform_api_conn, sfp_id))
445445
except Exception:
446-
pytest.fail("num_thermals is not an integer")
446+
pytest.fail("SFP {}: num_thermals is not an integer".format(sfp_id))
447447

448448
thermal_list = sfp.get_all_thermals(platform_api_conn, i)
449-
pytest_assert(thermal_list is not None, "Failed to retrieve thermals")
450-
pytest_assert(isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect")
449+
pytest_assert(thermal_list is not None, "Failed to retrieve thermals for sfp {}".format(sfp_id))
450+
pytest_assert(isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect for sfp {}".format(sfp_id))
451451

452452
for thermal_index in range(num_thermals):
453453
thermal = sfp.get_thermal(platform_api_conn, i, thermal_index)
454-
self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect".format(thermal_index))
454+
self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect for sfp {}".format(thermal_index, sfp_id))
455455
self.assert_expectations()

tests/platform_tests/api/test_thermal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,5 @@ def test_is_replaceable(self, platform_api_conn):
218218
for i in range(self.num_thermals):
219219
replaceable = thermal.is_replaceable(platform_api_conn, i)
220220
if self.expect(replaceable is not None, "Failed to perform is_replaceable for thermal {}".format(i)):
221-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for thermal [}".format(i))
221+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for thermal {}".format(i))
222222
self.assert_expectations()

0 commit comments

Comments
 (0)