Fix dynamic minimum fan table issue caused by python3 (#6690)
**- Why I did it** After migrating to python3, the operator '/' always get a float result, but it gets integer result in python2. Need fix this in thermal_conditions. **- How I did it** 1. cast float value to int 2. change the unit test case to cover this situation **- How to verify it** Manually test and regression test
This commit is contained in:
parent
834347b8f7
commit
6d4c20efb1
@ -85,7 +85,7 @@ class MinCoolingLevelChangeCondition(ThermalPolicyConditionBase):
|
||||
|
||||
trust_state = Thermal.check_module_temperature_trustable()
|
||||
temperature = Thermal.get_min_amb_temperature()
|
||||
temperature = temperature / 1000
|
||||
temperature = int(temperature / 1000)
|
||||
|
||||
change_cooling_level = False
|
||||
if trust_state != MinCoolingLevelChangeCondition.trust_state:
|
||||
|
@ -482,7 +482,7 @@ def test_dynamic_minimum_policy(thermal_manager):
|
||||
condition = policy.conditions[MinCoolingLevelChangeCondition]
|
||||
action = policy.actions[ChangeMinCoolingLevelAction]
|
||||
Thermal.check_module_temperature_trustable = MagicMock(return_value='trust')
|
||||
Thermal.get_min_amb_temperature = MagicMock(return_value=35000)
|
||||
Thermal.get_min_amb_temperature = MagicMock(return_value=35001)
|
||||
assert condition.is_match(None)
|
||||
assert MinCoolingLevelChangeCondition.trust_state == 'trust'
|
||||
assert MinCoolingLevelChangeCondition.temperature == 35
|
||||
@ -492,7 +492,7 @@ def test_dynamic_minimum_policy(thermal_manager):
|
||||
assert condition.is_match(None)
|
||||
assert MinCoolingLevelChangeCondition.trust_state == 'untrust'
|
||||
|
||||
Thermal.get_min_amb_temperature = MagicMock(return_value=25000)
|
||||
Thermal.get_min_amb_temperature = MagicMock(return_value=25999)
|
||||
assert condition.is_match(None)
|
||||
assert MinCoolingLevelChangeCondition.temperature == 25
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user