Tests: power_monitoring disable nonblocking writes (#29994)

* better error logging

* fix power monitoring test

* revert that

* properly patch it
This commit is contained in:
Justin Newberry 2023-09-20 16:51:46 -07:00 committed by GitHub
parent 1f8ceb4ca1
commit f69a45faba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -69,3 +69,7 @@ def with_processes(processes, init_time=0, ignore_stopped=None):
return wrap
return wrapper
def noop(*args, **kwargs):
pass

View File

@ -3,6 +3,7 @@ import unittest
from unittest.mock import patch
from openpilot.common.params import Params
from openpilot.selfdrive.test.helpers import noop
from openpilot.selfdrive.thermald.power_monitoring import PowerMonitoring, CAR_BATTERY_CAPACITY_uWh, \
CAR_CHARGING_RATE_W, VBATT_PAUSE_CHARGING, DELAY_SHUTDOWN_TIME_S
@ -25,6 +26,7 @@ def pm_patch(name, value, constant=False):
@patch("time.monotonic", new=mock_time_monotonic)
@patch("openpilot.selfdrive.thermald.power_monitoring.put_nonblocking", new=noop) # TODO: Remove this once nonblocking params are safer
class TestPowerMonitoring(unittest.TestCase):
def setUp(self):
self.params = Params()