Skip to content

Commit 798f6c5

Browse files
Move test functions to correct section
1 parent d4734bd commit 798f6c5

File tree

6 files changed

+82
-82
lines changed

6 files changed

+82
-82
lines changed

tests/platform_tests/api/test_chassis.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
135135
pytest_assert(status is not None, "Unable to retrieve chassis status")
136136
pytest_assert(isinstance(status, bool), "Chassis status appears incorrect")
137137

138+
def test_get_position_in_parent(self, platform_api_conn):
139+
position = chassis.get_position_in_parent(platform_api_conn)
140+
if self.expect(position is not None, "Failed to perform get_position_in_parent"):
141+
self.expect(isinstance(position, int), "Position value must be an integer value")
142+
self.assert_expectations()
143+
144+
def test_is_replaceable(self, platform_api_conn):
145+
replaceable = chassis.is_replaceable(platform_api_conn)
146+
if self.expect(replaceable is not None, "Failed to perform is_replaceable"):
147+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value")
148+
self.assert_expectations()
149+
138150
#
139151
# Functions to test methods defined in ChassisBase class
140152
#
@@ -381,15 +393,3 @@ def test_get_watchdog(self, duthost, localhost, platform_api_conn):
381393
def test_get_eeprom(self, duthost, localhost, platform_api_conn):
382394
eeprom = chassis.get_eeprom(platform_api_conn)
383395
pytest_assert(eeprom is not None, "Failed to retrieve system EEPROM")
384-
385-
def test_get_position_in_parent(self, platform_api_conn):
386-
position = chassis.get_position_in_parent(platform_api_conn)
387-
if self.expect(position is not None, "Failed to perform get_position_in_parent"):
388-
self.expect(isinstance(position, int), "Position value must be an integer value")
389-
self.assert_expectations()
390-
391-
def test_is_replaceable(self, platform_api_conn):
392-
replaceable = chassis.is_replaceable(platform_api_conn)
393-
if self.expect(replaceable is not None, "Failed to perform is_replaceable"):
394-
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value")
395-
self.assert_expectations()

tests/platform_tests/api/test_chassis_fans.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
129129

130130
self.assert_expectations()
131131

132+
def test_get_position_in_parent(self, platform_api_conn):
133+
for i in range(self.num_fans):
134+
position = fan.get_position_in_parent(platform_api_conn, i)
135+
if self.expect(position is not None, "Failed to perform get_position_in_parent for fan {}".format(i)):
136+
self.expect(isinstance(position, int), "Position value must be an integer value for fan {}".format(i))
137+
self.assert_expectations()
138+
139+
def test_is_replaceable(self, platform_api_conn):
140+
for i in range(self.num_fans):
141+
replaceable = fan.is_replaceable(platform_api_conn, i)
142+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for fan {}".format(i)):
143+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan {}".format(i))
144+
self.assert_expectations()
145+
132146
#
133147
# Functions to test methods defined in FanBase class
134148
#
@@ -221,17 +235,3 @@ def test_set_fans_led(self, duthost, localhost, platform_api_conn):
221235
color, color_actual, i))
222236

223237
self.assert_expectations()
224-
225-
def test_get_position_in_parent(self, platform_api_conn):
226-
for i in range(self.num_fans):
227-
position = fan.get_position_in_parent(platform_api_conn, i)
228-
if self.expect(position is not None, "Failed to perform get_position_in_parent for fan {}".format(i)):
229-
self.expect(isinstance(position, int), "Position value must be an integer value for fan {}".format(i))
230-
self.assert_expectations()
231-
232-
def test_is_replaceable(self, platform_api_conn):
233-
for i in range(self.num_fans):
234-
replaceable = fan.is_replaceable(platform_api_conn, i)
235-
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))
237-
self.assert_expectations()

tests/platform_tests/api/test_fan_drawer.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
110110

111111
self.assert_expectations()
112112

113+
def test_get_position_in_parent(self, platform_api_conn):
114+
for i in range(self.num_fan_drawers):
115+
position = fan_drawer.get_position_in_parent(platform_api_conn, i)
116+
if self.expect(position is not None, "Failed to perform get_position_in_parent for fan drawer {}".format(i)):
117+
self.expect(isinstance(position, int), "Position value must be an integer value for fan drawer {}".format(i))
118+
self.assert_expectations()
119+
120+
def test_is_replaceable(self, platform_api_conn):
121+
for i in range(self.num_fan_drawers):
122+
replaceable = fan_drawer.is_replaceable(platform_api_conn, i)
123+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for fan drawer {}".format(i)):
124+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for fan drawer {}".format(i))
125+
self.assert_expectations()
126+
113127
#
114128
# Functions to test methods defined in Fan_drawerBase class
115129
#
@@ -154,17 +168,3 @@ def test_set_fan_drawers_led(self, duthost, localhost, platform_api_conn):
154168
color, color_actual, i))
155169

156170
self.assert_expectations()
157-
158-
def test_get_position_in_parent(self, platform_api_conn):
159-
for i in range(self.num_fan_drawers):
160-
position = fan_drawer.get_position_in_parent(platform_api_conn, 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))
163-
self.assert_expectations()
164-
165-
def test_is_replaceable(self, platform_api_conn):
166-
for i in range(self.num_fan_drawers):
167-
replaceable = fan_drawer.is_replaceable(platform_api_conn, 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))
170-
self.assert_expectations()

tests/platform_tests/api/test_psu.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
111111
self.expect(isinstance(status, bool), "PSU {} status appears incorrect".format(i))
112112
self.assert_expectations()
113113

114+
def test_get_position_in_parent(self, platform_api_conn):
115+
for psu_id in range(self.num_psus):
116+
position = psu.get_position_in_parent(platform_api_conn, psu_id)
117+
if self.expect(position is not None, "Failed to perform get_position_in_parent for psu id {}".format(psu_id)):
118+
self.expect(isinstance(position, int), "Position value must be an integer value for psu id {}".format(psu_id))
119+
self.assert_expectations()
120+
121+
def test_is_replaceable(self, platform_api_conn):
122+
for psu_id in range(self.num_psus):
123+
replaceable = psu.is_replaceable(platform_api_conn, psu_id)
124+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for psu id {}".format(psu_id)):
125+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for psu id {}".format(psu_id))
126+
self.assert_expectations()
127+
114128
#
115129
# Functions to test methods defined in PsuBase class
116130
#
@@ -200,20 +214,6 @@ def test_led(self, duthost, localhost, platform_api_conn):
200214
self.expect(color == color_actual, "Status LED color incorrect (expected: {}, actual: {}) from PSU {}".format(color, color_actual, psu_id))
201215
self.assert_expectations()
202216

203-
def test_get_position_in_parent(self, platform_api_conn):
204-
for psu_id in range(self.num_psus):
205-
position = psu.get_position_in_parent(platform_api_conn, psu_id)
206-
if self.expect(position is not None, "Failed to perform get_position_in_parent for psu id {}".format(psu_id)):
207-
self.expect(isinstance(position, int), "Position value must be an integer value for psu id {}".format(psu_id))
208-
self.assert_expectations()
209-
210-
def test_is_replaceable(self, platform_api_conn):
211-
for psu_id in range(self.num_psus):
212-
replaceable = psu.is_replaceable(platform_api_conn, psu_id)
213-
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))
215-
self.assert_expectations()
216-
217217
def test_thermals(self, platform_api_conn):
218218
for psu_id in range(self.num_psus):
219219
try:

tests/platform_tests/api/test_sfp.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
177177
self.expect(isinstance(status, bool), "Transceiver {} status appears incorrect".format(i))
178178
self.assert_expectations()
179179

180+
def test_get_position_in_parent(self, platform_api_conn):
181+
for i in range(self.num_sfps):
182+
position = sfp.get_position_in_parent(platform_api_conn, i)
183+
if self.expect(position is not None, "Failed to perform get_position_in_parent for sfp {}".format(i)):
184+
self.expect(isinstance(position, int), "Position value must be an integer value for sfp {}".format(i))
185+
self.assert_expectations()
186+
187+
def test_is_replaceable(self, platform_api_conn):
188+
for sfp_id in range(self.num_sfps):
189+
replaceable = sfp.is_replaceable(platform_api_conn, sfp_id)
190+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for sfp {}".format(sfp_id)):
191+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for sfp {}".format(sfp_id))
192+
self.assert_expectations()
193+
180194
#
181195
# Functions to test methods defined in SfpBase class
182196
#
@@ -424,20 +438,6 @@ def test_power_override(self, duthost, localhost, platform_api_conn):
424438
self.expect(power_override is False, "Transceiver {} power override data is incorrect".format(i))
425439
self.assert_expectations()
426440

427-
def test_get_position_in_parent(self, platform_api_conn):
428-
for i in range(self.num_sfps):
429-
position = sfp.get_position_in_parent(platform_api_conn, i)
430-
if self.expect(position is not None, "Failed to perform get_position_in_parent for sfp {}".format(i)):
431-
self.expect(isinstance(position, int), "Position value must be an integer value for sfp {}".format(i))
432-
self.assert_expectations()
433-
434-
def test_is_replaceable(self, platform_api_conn):
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))
439-
self.assert_expectations()
440-
441441
def test_thermals(self, platform_api_conn):
442442
for sfp_id in range(self.num_sfps):
443443
try:

tests/platform_tests/api/test_thermal.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ def test_get_status(self, duthost, localhost, platform_api_conn):
118118

119119
self.assert_expectations()
120120

121+
def test_get_position_in_parent(self, platform_api_conn):
122+
for i in range(self.num_thermals):
123+
position = thermal.get_position_in_parent(platform_api_conn, i)
124+
if self.expect(position is not None, "Failed to perform get_position_in_parent for thermal {}".format(i)):
125+
self.expect(isinstance(position, int), "Position value must be an integer value for thermal {}".format(i))
126+
self.assert_expectations()
127+
128+
def test_is_replaceable(self, platform_api_conn):
129+
for i in range(self.num_thermals):
130+
replaceable = thermal.is_replaceable(platform_api_conn, i)
131+
if self.expect(replaceable is not None, "Failed to perform is_replaceable for thermal {}".format(i)):
132+
self.expect(isinstance(replaceable, bool), "Replaceable value must be a bool value for thermal {}".format(i))
133+
self.assert_expectations()
134+
121135
#
122136
# Functions to test methods defined in ThermalBase class
123137
#
@@ -206,17 +220,3 @@ def test_set_high_threshold(self, duthost, localhost, platform_api_conn):
206220
self.expect(temperature == 80,
207221
"Thermal {} high threshold {} is not matching the set value {}".format(i, temperature, high_temperature))
208222
self.assert_expectations()
209-
210-
def test_get_position_in_parent(self, platform_api_conn):
211-
for i in range(self.num_thermals):
212-
position = thermal.get_position_in_parent(platform_api_conn, i)
213-
if self.expect(position is not None, "Failed to perform get_position_in_parent for thermal {}".format(i)):
214-
self.expect(isinstance(position, int), "Position value must be an integer value for thermal {}".format(i))
215-
self.assert_expectations()
216-
217-
def test_is_replaceable(self, platform_api_conn):
218-
for i in range(self.num_thermals):
219-
replaceable = thermal.is_replaceable(platform_api_conn, i)
220-
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))
222-
self.assert_expectations()

0 commit comments

Comments
 (0)