Merge "Add at_least_B() decorator to restrict multi-device tests to Android B+ capable device." into main
This commit is contained in:
commit
d5dd81741c
2 changed files with 34 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ from mobly import asserts
|
|||
from mobly.controllers import android_device
|
||||
from mobly.controllers.android_device_lib.adb import AdbError
|
||||
from net_tests_utils.host.python import adb_utils, assert_utils
|
||||
import functools
|
||||
|
||||
|
||||
class PatternNotFoundException(Exception):
|
||||
|
|
@ -400,6 +401,20 @@ def assume_apf_version_support_at_least(
|
|||
f" {expected_version}",
|
||||
)
|
||||
|
||||
def at_least_B():
|
||||
def decorator(test_function):
|
||||
@functools.wraps(test_function)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
asserts.abort_class_if(
|
||||
(not hasattr(self, 'client')) or (not hasattr(self.client, 'isAtLeastB')),
|
||||
"client device is not B+"
|
||||
)
|
||||
|
||||
asserts.abort_class_if(not self.client.isAtLeastB(), "not B+")
|
||||
return test_function(self, *args, **kwargs)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
class AdbOutputHandler:
|
||||
def __init__(self, ad, cmd):
|
||||
self._ad = ad
|
||||
|
|
|
|||
|
|
@ -53,3 +53,4 @@ class MultiDevicesTestBase(base_test.BaseTestClass):
|
|||
raise_on_exception=True,
|
||||
)
|
||||
self.client = self.clientDevice.connectivity_multi_devices_snippet
|
||||
self.server = self.serverDevice.connectivity_multi_devices_snippet
|
||||
|
|
|
|||
Loading…
Reference in a new issue