Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions tests/platform_tests/api/test_thermal_leak_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class TestLeakSensorApi(PlatformApiTestBase):

num_leak_sensors = 0

@pytest.fixture(scope="function", autouse=True)
def assert_test_expectations(self):
"""Ensure accumulated self.expect() checks are asserted per test."""
del self.failed_expectations[:]
yield
self.assert_expectations()

@pytest.fixture(scope="function", autouse=True)
def resolve_num_leak_sensors(self, platform_api_conn): # noqa: F811
try:
Expand Down Expand Up @@ -122,12 +129,12 @@ def test_leak_sensor_profile(self, duthosts, enum_rand_one_per_hwsku_hostname, p

# get_leak_max_minor_duration_sec() on the profile
max_dur = leak_sensor.get_leak_max_minor_duration_sec(platform_api_conn, sensor_index)
if max_dur is None:
logger.info(f"Sensor {sensor_index} get_leak_max_minor_duration_sec() returned None "
if max_dur is None or max_dur == 0:
logger.info(f"Sensor {sensor_index} get_leak_max_minor_duration_sec() returned None or 0"
f"- platform does not support this attribute")
else:
self.expect(isinstance(max_dur, (int, float)) and max_dur > 0,
f"Sensor {sensor_index} max_minor_duration_sec={max_dur} should be non-zero")
f"Sensor {sensor_index} max_minor_duration_sec={max_dur} should be non-negative")

# get_all_profiles() on LiquidCoolingBase
all_profiles = liquid_cooling.get_all_profiles(platform_api_conn)
Expand Down