Skip to content

Commit a0479df

Browse files
authored
Revert "FW query timing test: mock get_data function for timeout (#29712)"
This reverts commit 4028cb6.
1 parent 62670e6 commit a0479df

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

selfdrive/car/tests/test_fw_fingerprint.py

+8-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import unittest
66
from collections import defaultdict
77
from parameterized import parameterized
8-
from unittest import mock
98
import threading
109

1110
from cereal import car
@@ -177,7 +176,7 @@ def test_fw_requests(self):
177176

178177
class TestFwFingerprintTiming(unittest.TestCase):
179178
N: int = 5
180-
TOL: float = 0.1
179+
TOL: float = 0.12
181180

182181
@staticmethod
183182
def _run_thread(thread: threading.Thread) -> float:
@@ -192,19 +191,12 @@ def _run_thread(thread: threading.Thread) -> float:
192191
return time.perf_counter() - t
193192

194193
def _benchmark_brand(self, brand, num_pandas):
195-
def fake_get_data(_, timeout):
196-
nonlocal fake_timeout_time
197-
fake_timeout_time += timeout
198-
return {}
199-
200-
with mock.patch("openpilot.selfdrive.car.isotp_parallel_query.IsoTpParallelQuery.get_data", fake_get_data):
201-
fake_socket = FakeSocket()
202-
brand_time = 0
203-
for _ in range(self.N):
204-
fake_timeout_time = 0
205-
thread = threading.Thread(target=get_fw_versions, args=(fake_socket, fake_socket, brand),
206-
kwargs=dict(num_pandas=num_pandas))
207-
brand_time += self._run_thread(thread) + fake_timeout_time
194+
fake_socket = FakeSocket()
195+
brand_time = 0
196+
for _ in range(self.N):
197+
thread = threading.Thread(target=get_fw_versions, args=(fake_socket, fake_socket, brand),
198+
kwargs=dict(num_pandas=num_pandas))
199+
brand_time += self._run_thread(thread)
208200

209201
return brand_time / self.N
210202

@@ -235,7 +227,7 @@ def test_startup_timing(self):
235227

236228
@pytest.mark.timeout(60)
237229
def test_fw_query_timing(self):
238-
total_ref_time = 6.58
230+
total_ref_time = 6.41
239231
brand_ref_times = {
240232
1: {
241233
'body': 0.11,

0 commit comments

Comments
 (0)