Skip to content

Commit

Permalink
Fix benchmarks not working after latest refactoring (esphome#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Nov 21, 2023
1 parent 16c1167 commit 9d785d7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions bench/raw_ble_plain_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io
import timeit

from aioesphomeapi import APIConnection
from aioesphomeapi._frame_helper import APIPlaintextFrameHelper
from aioesphomeapi._frame_helper.plain_text import _cached_varuint_to_bytes
from aioesphomeapi.api_pb2 import (
Expand All @@ -10,6 +10,7 @@

# cythonize -X language_level=3 -a -i aioesphomeapi/_frame_helper/plain_text.py
# cythonize -X language_level=3 -a -i aioesphomeapi/_frame_helper/base.py
# cythonize -X language_level=3 -a -i aioesphomeapi/connection.py

adv = BluetoothLERawAdvertisementsResponse()
fake_adv = BluetoothLERawAdvertisement(
Expand All @@ -32,16 +33,21 @@
)


def _packet(type_: int, data: bytes):
pass
class MockConnection(APIConnection):
def __init__(self, *args, **kwargs):
pass

def process_packet(self, type_: int, data: bytes):
pass

def _on_error(exc: Exception):
raise exc
def report_fatal_error(self, exc: Exception):
raise exc


connection = MockConnection()

helper = APIPlaintextFrameHelper(
on_pkt=_packet, on_error=_on_error, client_info="my client", log_name="test"
connection=connection, client_info="my client", log_name="test"
)


Expand Down

0 comments on commit 9d785d7

Please sign in to comment.