1# Copyright (C) 2024 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Ranging base test.""" 15 16import logging 17import re 18 19from mobly import base_test 20from mobly import records 21from mobly import test_runner 22from mobly.controllers import android_device 23 24from test_utils import uwb_test_utils 25 26RELEASE_ID_REGEX = re.compile(r"\w+\.\d+\.\d+") 27 28 29class RangingBaseTest(base_test.BaseTestClass): 30 """Base class for Uwb tests.""" 31 32 def setup_class(self): 33 """Sets up the Android devices for Uwb test.""" 34 super().setup_class() 35 self.android_devices = self.register_controller(android_device, 36 min_number=2) 37 for ad in self.android_devices: 38 ad.load_snippet("ranging", "multidevices.snippet.ranging") 39 40 # for ad in self.android_devices: 41 # uwb_test_utils.initialize_uwb_country_code_if_not_set(ad) 42 43 def setup_test(self): 44 super().setup_test() 45 for ad in self.android_devices: 46 dev1 = ad.ranging 47 dev1.logInfo("*** TEST START: " + self.current_test_info.name + " ***") 48 49 def teardown_test(self): 50 super().teardown_test() 51 # for ad in self.android_devices: 52 # ad.ranging.logInfo("*** TEST END: " + self.current_test_info.name + " ***") 53 54 def teardown_class(self): 55 super().teardown_class() 56 57 58if __name__ == "__main__": 59 test_runner.main() 60