Loading android/pandora/test/gatt_test.py +8 −2 Original line number Diff line number Diff line Loading @@ -15,14 +15,15 @@ import asyncio import logging from avatar import BumbleDevice, PandoraDevice, PandoraDevices, asynchronous from avatar import BumbleDevice, PandoraDevice, PandoraDevices, asynchronous, bumble_server from bumble.gatt import Characteristic, Service from bumble.smp import PairingConfig from bumble_experimental.gatt import GATTService from mobly import base_test, test_runner from pandora.host_pb2 import RANDOM, Connection, DataTypes from pandora.security_pb2 import LE_LEVEL3, PairingEventAnswer, SecureResponse from pandora_experimental.gatt_grpc import GATT from pandora_experimental.gatt_grpc_aio import GATT as AioGATT from pandora_experimental.gatt_grpc_aio import GATT as AioGATT, add_GATTServicer_to_server from pandora_experimental.gatt_pb2 import SUCCESS, ReadCharacteristicsFromUuidResponse from typing import Optional, Tuple Loading @@ -35,6 +36,11 @@ class GattTest(base_test.BaseTestClass): # type: ignore[misc] ref: BumbleDevice def setup_class(self) -> None: # Register experimental bumble servicers hook. bumble_server.register_servicer_hook( lambda bumble, server: add_GATTServicer_to_server(GATTService(bumble.device), server) ) self.devices = PandoraDevices(self) dut, ref = self.devices assert isinstance(ref, BumbleDevice) Loading android/pandora/test/main.py +0 −12 Original line number Diff line number Diff line Loading @@ -6,26 +6,17 @@ import argparse import asha_test import example import gatt_test import grpc.aio import logging import os import sys from avatar import bumble_server from avatar.bumble_device import BumbleDevice from bumble_experimental.gatt import GATTService from collections import OrderedDict from mobly import base_test, config_parser, signals, suite_runner, test_runner from pandora_experimental.gatt_grpc_aio import add_GATTServicer_to_server from typing import Any, List, Optional, Type _TEST_CLASSES_LIST = [example.ExampleTest, asha_test.ASHATest, gatt_test.GattTest] def _bumble_servicer_hook(bumble: BumbleDevice, server: grpc.aio.Server) -> None: add_GATTServicer_to_server(GATTService(bumble.device), server) def _parse_cli_args(argv: List[str]) -> argparse.Namespace: parser = argparse.ArgumentParser(description='Mobly Suite Executable.') parser.add_argument('-c', '--config', type=str, metavar='<PATH>', help='Path to the test configuration file.') Loading Loading @@ -124,8 +115,5 @@ if __name__ == "__main__": root = str(os.path.dirname(__file__)) default_argv = ['-c', os.path.join(root, 'config.yml')] # Register experimental bumble servicers hook. bumble_server.register_servicer_hook(_bumble_servicer_hook) # Run the test suite. run(_TEST_CLASSES_LIST, default_argv + argv) Loading
android/pandora/test/gatt_test.py +8 −2 Original line number Diff line number Diff line Loading @@ -15,14 +15,15 @@ import asyncio import logging from avatar import BumbleDevice, PandoraDevice, PandoraDevices, asynchronous from avatar import BumbleDevice, PandoraDevice, PandoraDevices, asynchronous, bumble_server from bumble.gatt import Characteristic, Service from bumble.smp import PairingConfig from bumble_experimental.gatt import GATTService from mobly import base_test, test_runner from pandora.host_pb2 import RANDOM, Connection, DataTypes from pandora.security_pb2 import LE_LEVEL3, PairingEventAnswer, SecureResponse from pandora_experimental.gatt_grpc import GATT from pandora_experimental.gatt_grpc_aio import GATT as AioGATT from pandora_experimental.gatt_grpc_aio import GATT as AioGATT, add_GATTServicer_to_server from pandora_experimental.gatt_pb2 import SUCCESS, ReadCharacteristicsFromUuidResponse from typing import Optional, Tuple Loading @@ -35,6 +36,11 @@ class GattTest(base_test.BaseTestClass): # type: ignore[misc] ref: BumbleDevice def setup_class(self) -> None: # Register experimental bumble servicers hook. bumble_server.register_servicer_hook( lambda bumble, server: add_GATTServicer_to_server(GATTService(bumble.device), server) ) self.devices = PandoraDevices(self) dut, ref = self.devices assert isinstance(ref, BumbleDevice) Loading
android/pandora/test/main.py +0 −12 Original line number Diff line number Diff line Loading @@ -6,26 +6,17 @@ import argparse import asha_test import example import gatt_test import grpc.aio import logging import os import sys from avatar import bumble_server from avatar.bumble_device import BumbleDevice from bumble_experimental.gatt import GATTService from collections import OrderedDict from mobly import base_test, config_parser, signals, suite_runner, test_runner from pandora_experimental.gatt_grpc_aio import add_GATTServicer_to_server from typing import Any, List, Optional, Type _TEST_CLASSES_LIST = [example.ExampleTest, asha_test.ASHATest, gatt_test.GattTest] def _bumble_servicer_hook(bumble: BumbleDevice, server: grpc.aio.Server) -> None: add_GATTServicer_to_server(GATTService(bumble.device), server) def _parse_cli_args(argv: List[str]) -> argparse.Namespace: parser = argparse.ArgumentParser(description='Mobly Suite Executable.') parser.add_argument('-c', '--config', type=str, metavar='<PATH>', help='Path to the test configuration file.') Loading Loading @@ -124,8 +115,5 @@ if __name__ == "__main__": root = str(os.path.dirname(__file__)) default_argv = ['-c', os.path.join(root, 'config.yml')] # Register experimental bumble servicers hook. bumble_server.register_servicer_hook(_bumble_servicer_hook) # Run the test suite. run(_TEST_CLASSES_LIST, default_argv + argv)