5
5
import unittest
6
6
from collections import defaultdict
7
7
from parameterized import parameterized
8
- from unittest import mock
9
8
import threading
10
9
11
10
from cereal import car
@@ -177,7 +176,7 @@ def test_fw_requests(self):
177
176
178
177
class TestFwFingerprintTiming (unittest .TestCase ):
179
178
N : int = 5
180
- TOL : float = 0.1
179
+ TOL : float = 0.12
181
180
182
181
@staticmethod
183
182
def _run_thread (thread : threading .Thread ) -> float :
@@ -192,19 +191,12 @@ def _run_thread(thread: threading.Thread) -> float:
192
191
return time .perf_counter () - t
193
192
194
193
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 )
208
200
209
201
return brand_time / self .N
210
202
@@ -235,7 +227,7 @@ def test_startup_timing(self):
235
227
236
228
@pytest .mark .timeout (60 )
237
229
def test_fw_query_timing (self ):
238
- total_ref_time = 6.58
230
+ total_ref_time = 6.41
239
231
brand_ref_times = {
240
232
1 : {
241
233
'body' : 0.11 ,
0 commit comments