Move to 2-space indent: tests/lib/*.py. (#707)
diff --git a/tests/lib/integration2_test.py b/tests/lib/integration2_test.py
index 4801fb6..2a37b95 100755
--- a/tests/lib/integration2_test.py
+++ b/tests/lib/integration2_test.py
@@ -18,10 +18,10 @@
class Integration2Test(integration_test.IntegrationTest):
- """Same as the IntegrationTest class, created this so we have two
- 'different' test classes to use in unit tests.
- """
+ """Same as the IntegrationTest class, created this so we have two
+ 'different' test classes to use in unit tests.
+ """
if __name__ == "__main__":
- test_runner.main()
+ test_runner.main()
diff --git a/tests/lib/integration3_test.py b/tests/lib/integration3_test.py
index a790db2..7baf145 100755
--- a/tests/lib/integration3_test.py
+++ b/tests/lib/integration3_test.py
@@ -18,17 +18,17 @@
class Integration3Test(base_test.BaseTestClass):
- """This test class is used to cause a failure in integration tests."""
+ """This test class is used to cause a failure in integration tests."""
- def setup_class(self):
- asserts.fail('Setup failure.')
+ def setup_class(self):
+ asserts.fail('Setup failure.')
- def on_fail(self, record):
- asserts.abort_all('Skip tests.')
+ def on_fail(self, record):
+ asserts.abort_all('Skip tests.')
- def test_empty(self):
- pass
+ def test_empty(self):
+ pass
if __name__ == '__main__':
- test_runner.main()
+ test_runner.main()
diff --git a/tests/lib/integration_test.py b/tests/lib/integration_test.py
index ca33d86..bd2af1a 100755
--- a/tests/lib/integration_test.py
+++ b/tests/lib/integration_test.py
@@ -22,20 +22,20 @@
class IntegrationTest(base_test.BaseTestClass):
- def setup_class(self):
- self.register_controller(mock_controller)
+ def setup_class(self):
+ self.register_controller(mock_controller)
- def test_hello_world(self):
- asserts.assert_equal(self.user_params['icecream'], 42)
- asserts.assert_equal(self.user_params['extra_param'], 'haha')
- logging.info('This is a bare minimal test to make sure the basic MOBLY'
- ' test flow works.')
- asserts.explicit_pass(
- 'Hello World',
- # Use a unicode string here to make sure the full log pipeline
- # works with unicode.
- extras=u'\u2022')
+ def test_hello_world(self):
+ asserts.assert_equal(self.user_params['icecream'], 42)
+ asserts.assert_equal(self.user_params['extra_param'], 'haha')
+ logging.info('This is a bare minimal test to make sure the basic MOBLY'
+ ' test flow works.')
+ asserts.explicit_pass(
+ 'Hello World',
+ # Use a unicode string here to make sure the full log pipeline
+ # works with unicode.
+ extras=u'\u2022')
if __name__ == '__main__':
- test_runner.main()
+ test_runner.main()
diff --git a/tests/lib/jsonrpc_client_test_base.py b/tests/lib/jsonrpc_client_test_base.py
index b033771..16a4d85 100755
--- a/tests/lib/jsonrpc_client_test_base.py
+++ b/tests/lib/jsonrpc_client_test_base.py
@@ -20,66 +20,66 @@
class JsonRpcClientTestBase(unittest.TestCase):
- """Base class for tests of JSONRPC clients.
+ """Base class for tests of JSONRPC clients.
- Contains infrastructure for mocking responses.
+ Contains infrastructure for mocking responses.
+ """
+
+ MOCK_RESP = (
+ b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
+ b'"callback": null}')
+ MOCK_RESP_WITHOUT_CALLBACK = (
+ b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1}')
+ MOCK_RESP_TEMPLATE = (
+ '{"id": %d, "result": 123, "error": null, "status": 1, "uid": 1, '
+ '"callback": null}')
+ MOCK_RESP_UNKNOWN_STATUS = (
+ b'{"id": 0, "result": 123, "error": null, "status": 0, '
+ b'"callback": null}')
+ MOCK_RESP_WITH_CALLBACK = (
+ b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
+ b'"callback": "1-0"}')
+ MOCK_RESP_WITH_ERROR = b'{"id": 0, "error": 1, "status": 1, "uid": 1}'
+ MOCK_RESP_FLEXIABLE_RESULT_LENGTH = (
+ '{"id": 0, "result": "%s", "error": null, "status": 0, "callback": null}'
+ )
+
+ class MockSocketFile(object):
+ def __init__(self, resp):
+ self.resp = resp
+ self.last_write = None
+
+ def write(self, msg):
+ self.last_write = msg
+
+ def readline(self):
+ return self.resp
+
+ def flush(self):
+ pass
+
+ def setup_mock_socket_file(self, mock_create_connection, resp=MOCK_RESP):
+ """Sets up a fake socket file from the mock connection.
+
+ Args:
+ mock_create_connection: The mock method for creating a method.
+ resp: (str) response to give. MOCK_RESP by default.
+
+ Returns:
+ The mock file that will be injected into the code.
"""
+ fake_file = self.MockSocketFile(resp)
+ fake_conn = mock.MagicMock()
+ fake_conn.makefile.return_value = fake_file
+ mock_create_connection.return_value = fake_conn
+ return fake_file
- MOCK_RESP = (
- b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
- b'"callback": null}')
- MOCK_RESP_WITHOUT_CALLBACK = (
- b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1}')
- MOCK_RESP_TEMPLATE = (
- '{"id": %d, "result": 123, "error": null, "status": 1, "uid": 1, '
- '"callback": null}')
- MOCK_RESP_UNKNOWN_STATUS = (
- b'{"id": 0, "result": 123, "error": null, "status": 0, '
- b'"callback": null}')
- MOCK_RESP_WITH_CALLBACK = (
- b'{"id": 0, "result": 123, "error": null, "status": 1, "uid": 1, '
- b'"callback": "1-0"}')
- MOCK_RESP_WITH_ERROR = b'{"id": 0, "error": 1, "status": 1, "uid": 1}'
- MOCK_RESP_FLEXIABLE_RESULT_LENGTH = (
- '{"id": 0, "result": "%s", "error": null, "status": 0, "callback": null}'
- )
-
- class MockSocketFile(object):
- def __init__(self, resp):
- self.resp = resp
- self.last_write = None
-
- def write(self, msg):
- self.last_write = msg
-
- def readline(self):
- return self.resp
-
- def flush(self):
- pass
-
- def setup_mock_socket_file(self, mock_create_connection, resp=MOCK_RESP):
- """Sets up a fake socket file from the mock connection.
-
- Args:
- mock_create_connection: The mock method for creating a method.
- resp: (str) response to give. MOCK_RESP by default.
-
- Returns:
- The mock file that will be injected into the code.
- """
- fake_file = self.MockSocketFile(resp)
- fake_conn = mock.MagicMock()
- fake_conn.makefile.return_value = fake_file
- mock_create_connection.return_value = fake_conn
- return fake_file
-
- def generate_rpc_response(self, response_length=1024):
- # TODO: Py2 deprecation
- # .encode('utf-8') is for py2 compatibility, after py2 deprecation, it
- # could be modified to byte('xxxxx', 'utf-8')
- return bytes((self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH % ''.join(
- random.choice(string.ascii_lowercase)
- for i in range(response_length -
- len(self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH) + 2))
- ).encode('utf-8'))
+ def generate_rpc_response(self, response_length=1024):
+ # TODO: Py2 deprecation
+ # .encode('utf-8') is for py2 compatibility, after py2 deprecation, it
+ # could be modified to byte('xxxxx', 'utf-8')
+ return bytes((self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH % ''.join(
+ random.choice(string.ascii_lowercase)
+ for i in range(response_length -
+ len(self.MOCK_RESP_FLEXIABLE_RESULT_LENGTH) + 2))
+ ).encode('utf-8'))
diff --git a/tests/lib/mock_android_device.py b/tests/lib/mock_android_device.py
index e6804e7..2eaac66 100755
--- a/tests/lib/mock_android_device.py
+++ b/tests/lib/mock_android_device.py
@@ -22,153 +22,153 @@
import os
DEFAULT_MOCK_PROPERTIES = {
- 'ro.build.id': 'AB42',
- 'ro.build.type': 'userdebug',
- 'ro.build.product': 'FakeModel',
- 'ro.build.version.codename': 'Z',
- 'ro.build.version.sdk': '28',
- 'ro.product.name': 'FakeModel',
- 'ro.debuggable': '1',
- 'sys.boot_completed': "1",
- 'ro.build.characteristics': 'emulator,phone',
- 'ro.hardware': 'marlin',
+ 'ro.build.id': 'AB42',
+ 'ro.build.type': 'userdebug',
+ 'ro.build.product': 'FakeModel',
+ 'ro.build.version.codename': 'Z',
+ 'ro.build.version.sdk': '28',
+ 'ro.product.name': 'FakeModel',
+ 'ro.debuggable': '1',
+ 'sys.boot_completed': "1",
+ 'ro.build.characteristics': 'emulator,phone',
+ 'ro.hardware': 'marlin',
}
class Error(Exception):
- pass
+ pass
def get_mock_ads(num):
- """Generates a list of mock AndroidDevice objects.
+ """Generates a list of mock AndroidDevice objects.
- The serial number of each device will be integer 0 through num - 1.
+ The serial number of each device will be integer 0 through num - 1.
- Args:
- num: An integer that is the number of mock AndroidDevice objects to
- create.
- """
- ads = []
- for i in range(num):
- ad = mock.MagicMock(name="AndroidDevice", serial=str(i), h_port=None)
- ad.skip_logcat = False
- ads.append(ad)
- return ads
+ Args:
+ num: An integer that is the number of mock AndroidDevice objects to
+ create.
+ """
+ ads = []
+ for i in range(num):
+ ad = mock.MagicMock(name="AndroidDevice", serial=str(i), h_port=None)
+ ad.skip_logcat = False
+ ads.append(ad)
+ return ads
def get_all_instances():
- return get_mock_ads(5)
+ return get_mock_ads(5)
def get_instances(serials):
- ads = []
- for serial in serials:
- ad = mock.MagicMock(name="AndroidDevice", serial=serial, h_port=None)
- ads.append(ad)
- return ads
+ ads = []
+ for serial in serials:
+ ad = mock.MagicMock(name="AndroidDevice", serial=serial, h_port=None)
+ ads.append(ad)
+ return ads
def get_instances_with_configs(dicts):
- return get_instances([d['serial'] for d in dicts])
+ return get_instances([d['serial'] for d in dicts])
def list_adb_devices():
- return [ad.serial for ad in get_mock_ads(5)]
+ return [ad.serial for ad in get_mock_ads(5)]
class MockAdbProxy(object):
- """Mock class that swaps out calls to adb with mock calls."""
+ """Mock class that swaps out calls to adb with mock calls."""
- def __init__(self,
- serial='',
- fail_br=False,
- fail_br_before_N=False,
- mock_properties=None,
- installed_packages=None,
- instrumented_packages=None):
- self.serial = serial
- self.fail_br = fail_br
- self.fail_br_before_N = fail_br_before_N
- self.getprops_call_count = 0
- if mock_properties is None:
- self.mock_properties = DEFAULT_MOCK_PROPERTIES.copy()
- else:
- self.mock_properties = mock_properties
- if installed_packages is None:
- installed_packages = []
- self.installed_packages = installed_packages
- if instrumented_packages is None:
- instrumented_packages = []
- self.installed_packages = installed_packages
- self.instrumented_packages = instrumented_packages
+ def __init__(self,
+ serial='',
+ fail_br=False,
+ fail_br_before_N=False,
+ mock_properties=None,
+ installed_packages=None,
+ instrumented_packages=None):
+ self.serial = serial
+ self.fail_br = fail_br
+ self.fail_br_before_N = fail_br_before_N
+ self.getprops_call_count = 0
+ if mock_properties is None:
+ self.mock_properties = DEFAULT_MOCK_PROPERTIES.copy()
+ else:
+ self.mock_properties = mock_properties
+ if installed_packages is None:
+ installed_packages = []
+ self.installed_packages = installed_packages
+ if instrumented_packages is None:
+ instrumented_packages = []
+ self.installed_packages = installed_packages
+ self.instrumented_packages = instrumented_packages
- def shell(self, params, timeout=None):
- if params == "id -u":
- return b"root"
- elif params == "bugreportz":
- if self.fail_br:
- return b"OMG I died!\n"
- return b'OK:/path/bugreport.zip\n'
- elif params == "bugreportz -v":
- if self.fail_br_before_N:
- return b"/system/bin/sh: bugreportz: not found"
- return b'1.1'
- elif 'pm list package' in params:
- packages = self.installed_packages + [
- package for package, _, _ in self.instrumented_packages
- ]
- return bytes(
- '\n'.join(['package:%s' % package for package in packages]),
- 'utf-8')
- elif 'pm list instrumentation' in params:
- return bytes(
- '\n'.join([
- 'instrumentation:%s/%s (target=%s)' %
- (package, runner, target)
- for package, runner, target in self.instrumented_packages
- ]), 'utf-8')
- elif 'which' in params:
- return b''
+ def shell(self, params, timeout=None):
+ if params == "id -u":
+ return b"root"
+ elif params == "bugreportz":
+ if self.fail_br:
+ return b"OMG I died!\n"
+ return b'OK:/path/bugreport.zip\n'
+ elif params == "bugreportz -v":
+ if self.fail_br_before_N:
+ return b"/system/bin/sh: bugreportz: not found"
+ return b'1.1'
+ elif 'pm list package' in params:
+ packages = self.installed_packages + [
+ package for package, _, _ in self.instrumented_packages
+ ]
+ return bytes(
+ '\n'.join(['package:%s' % package for package in packages]),
+ 'utf-8')
+ elif 'pm list instrumentation' in params:
+ return bytes(
+ '\n'.join([
+ 'instrumentation:%s/%s (target=%s)' %
+ (package, runner, target)
+ for package, runner, target in self.instrumented_packages
+ ]), 'utf-8')
+ elif 'which' in params:
+ return b''
- def getprop(self, params):
- if params in self.mock_properties:
- return self.mock_properties[params]
+ def getprop(self, params):
+ if params in self.mock_properties:
+ return self.mock_properties[params]
- def getprops(self, params):
- self.getprops_call_count = self.getprops_call_count + 1
- return self.mock_properties
+ def getprops(self, params):
+ self.getprops_call_count = self.getprops_call_count + 1
+ return self.mock_properties
- def bugreport(self, args, shell=False, timeout=None):
- expected = os.path.join(
- logging.log_path, 'AndroidDevice%s' % self.serial, 'BugReports',
- 'bugreport,test_something,%s,fakemodel,sometime' % self.serial)
- if expected not in args:
- raise Error('"Expected "%s", got "%s"' % (expected, args))
+ def bugreport(self, args, shell=False, timeout=None):
+ expected = os.path.join(
+ logging.log_path, 'AndroidDevice%s' % self.serial, 'BugReports',
+ 'bugreport,test_something,%s,fakemodel,sometime' % self.serial)
+ if expected not in args:
+ raise Error('"Expected "%s", got "%s"' % (expected, args))
- def __getattr__(self, name):
- """All calls to the none-existent functions in adb proxy would
- simply return the adb command string.
- """
+ def __getattr__(self, name):
+ """All calls to the none-existent functions in adb proxy would
+ simply return the adb command string.
+ """
- def adb_call(*args, **kwargs):
- arg_str = ' '.join(str(elem) for elem in args)
- return arg_str
+ def adb_call(*args, **kwargs):
+ arg_str = ' '.join(str(elem) for elem in args)
+ return arg_str
- return adb_call
+ return adb_call
class MockFastbootProxy(object):
- """Mock class that swaps out calls to adb with mock calls."""
+ """Mock class that swaps out calls to adb with mock calls."""
- def __init__(self, serial):
- self.serial = serial
+ def __init__(self, serial):
+ self.serial = serial
- def devices(self):
- return b"xxxx device\nyyyy device"
+ def devices(self):
+ return b"xxxx device\nyyyy device"
- def __getattr__(self, name):
- def fastboot_call(*args):
- arg_str = ' '.join(str(elem) for elem in args)
- return arg_str
+ def __getattr__(self, name):
+ def fastboot_call(*args):
+ arg_str = ' '.join(str(elem) for elem in args)
+ return arg_str
- return fastboot_call
+ return fastboot_call
diff --git a/tests/lib/mock_controller.py b/tests/lib/mock_controller.py
index 56dad1b..b6df7c0 100644
--- a/tests/lib/mock_controller.py
+++ b/tests/lib/mock_controller.py
@@ -20,32 +20,32 @@
def create(configs):
- objs = []
- for c in configs:
- if isinstance(c, dict):
- c.pop("serial")
- objs.append(MagicDevice(c))
- return objs
+ objs = []
+ for c in configs:
+ if isinstance(c, dict):
+ c.pop("serial")
+ objs.append(MagicDevice(c))
+ return objs
def destroy(objs):
- print("Destroying magic")
+ print("Destroying magic")
def get_info(objs):
- infos = []
- for obj in objs:
- infos.append(obj.who_am_i())
- return infos
+ infos = []
+ for obj in objs:
+ infos.append(obj.who_am_i())
+ return infos
class MagicDevice(object):
- def __init__(self, config):
- self.magic = config
+ def __init__(self, config):
+ self.magic = config
- def get_magic(self):
- logging.info("My magic is %s.", self.magic)
- return self.magic
+ def get_magic(self):
+ logging.info("My magic is %s.", self.magic)
+ return self.magic
- def who_am_i(self):
- return {"MyMagic": self.magic}
+ def who_am_i(self):
+ return {"MyMagic": self.magic}
diff --git a/tests/lib/mock_instrumentation_test.py b/tests/lib/mock_instrumentation_test.py
index 5cbc873..08f33e1 100644
--- a/tests/lib/mock_instrumentation_test.py
+++ b/tests/lib/mock_instrumentation_test.py
@@ -24,23 +24,23 @@
class MockInstrumentationTest(
- base_instrumentation_test.BaseInstrumentationTestClass):
- def __init__(self, tmp_dir, user_params={}):
- mock_test_run_configs = config_parser.TestRunConfig()
- mock_test_run_configs.summary_writer = mock.Mock()
- mock_test_run_configs.log_path = tmp_dir
- mock_test_run_configs.user_params = user_params
- mock_test_run_configs.reporter = mock.MagicMock()
- super(MockInstrumentationTest, self).__init__(mock_test_run_configs)
+ base_instrumentation_test.BaseInstrumentationTestClass):
+ def __init__(self, tmp_dir, user_params={}):
+ mock_test_run_configs = config_parser.TestRunConfig()
+ mock_test_run_configs.summary_writer = mock.Mock()
+ mock_test_run_configs.log_path = tmp_dir
+ mock_test_run_configs.user_params = user_params
+ mock_test_run_configs.reporter = mock.MagicMock()
+ super(MockInstrumentationTest, self).__init__(mock_test_run_configs)
- def run_mock_instrumentation_test(self, instrumentation_output, prefix):
- def fake_instrument(package, options=None, runner=None, handler=None):
- for line in instrumentation_output.splitlines():
- handler(line)
- return instrumentation_output
+ def run_mock_instrumentation_test(self, instrumentation_output, prefix):
+ def fake_instrument(package, options=None, runner=None, handler=None):
+ for line in instrumentation_output.splitlines():
+ handler(line)
+ return instrumentation_output
- mock_device = mock.Mock(spec=android_device.AndroidDevice)
- mock_device.adb = mock.Mock(spec=adb.AdbProxy)
- mock_device.adb.instrument = fake_instrument
- return self.run_instrumentation_test(
- mock_device, MOCK_TEST_PACKAGE, prefix=prefix)
+ mock_device = mock.Mock(spec=android_device.AndroidDevice)
+ mock_device.adb = mock.Mock(spec=adb.AdbProxy)
+ mock_device.adb.instrument = fake_instrument
+ return self.run_instrumentation_test(
+ mock_device, MOCK_TEST_PACKAGE, prefix=prefix)
diff --git a/tests/lib/mock_second_controller.py b/tests/lib/mock_second_controller.py
index a4a847a..908b53d 100644
--- a/tests/lib/mock_second_controller.py
+++ b/tests/lib/mock_second_controller.py
@@ -21,39 +21,39 @@
def create(configs):
- objs = []
- for c in configs:
- if isinstance(c, dict):
- c.pop("serial")
- objs.append(AnotherMagicDevice(c))
- return objs
+ objs = []
+ for c in configs:
+ if isinstance(c, dict):
+ c.pop("serial")
+ objs.append(AnotherMagicDevice(c))
+ return objs
def destroy(objs):
- print("Destroying other magic")
+ print("Destroying other magic")
def get_info(objs):
- infos = []
- for obj in objs:
- infos.append(obj.who_am_i())
- return infos
+ infos = []
+ for obj in objs:
+ infos.append(obj.who_am_i())
+ return infos
class AnotherMagicDevice(object):
- """This controller supports adding controller's info during test.
+ """This controller supports adding controller's info during test.
- It is used for testing that this info is correctly recorded by Mobly.
- """
- def __init__(self, config):
- self.magic = config
+ It is used for testing that this info is correctly recorded by Mobly.
+ """
+ def __init__(self, config):
+ self.magic = config
- def get_magic(self):
- logging.info("My other magic is %s.", self.magic)
- return self.magic
+ def get_magic(self):
+ logging.info("My other magic is %s.", self.magic)
+ return self.magic
- def set_magic(self, extra_magic):
- self.magic['extra_magic'] = extra_magic
+ def set_magic(self, extra_magic):
+ self.magic['extra_magic'] = extra_magic
- def who_am_i(self):
- return {"MyOtherMagic": self.magic}
+ def who_am_i(self):
+ return {"MyOtherMagic": self.magic}
diff --git a/tests/lib/multiple_subclasses_module.py b/tests/lib/multiple_subclasses_module.py
index 0a82cfd..e78beb7 100755
--- a/tests/lib/multiple_subclasses_module.py
+++ b/tests/lib/multiple_subclasses_module.py
@@ -16,10 +16,10 @@
from mobly import test_runner
class Subclass1Test(base_test.BaseTestClass):
- pass
+ pass
class Subclass2Test(base_test.BaseTestClass):
- pass
+ pass
class Subclass1Runner(test_runner.TestRunner):
pass
@@ -29,4 +29,3 @@
class UnrelatedClass(object):
pass
-
diff --git a/tests/lib/teardown_class_failure_test.py b/tests/lib/teardown_class_failure_test.py
index bf88411..596476b 100755
--- a/tests/lib/teardown_class_failure_test.py
+++ b/tests/lib/teardown_class_failure_test.py
@@ -17,12 +17,12 @@
class TearDownClassFailureTest(base_test.BaseTestClass):
- def test_foo(self):
- pass
+ def test_foo(self):
+ pass
- def teardown_class(self):
- raise Exception('Teardown class failed.')
+ def teardown_class(self):
+ raise Exception('Teardown class failed.')
if __name__ == '__main__':
- test_runner.main()
+ test_runner.main()
diff --git a/tests/lib/utils.py b/tests/lib/utils.py
index 78edb0a..8f1da4a 100644
--- a/tests/lib/utils.py
+++ b/tests/lib/utils.py
@@ -18,22 +18,22 @@
def validate_test_result(result):
- """Validate basic properties of a test result.
+ """Validate basic properties of a test result.
- The records in each bucket of the test result should have the corresponding
- result enum.
+ The records in each bucket of the test result should have the corresponding
+ result enum.
- Args:
- result: The `records.TestResult` object to validate.
- """
- buckets = [
- (result.passed, records.TestResultEnums.TEST_RESULT_PASS),
- (result.failed, records.TestResultEnums.TEST_RESULT_FAIL),
- (result.error, records.TestResultEnums.TEST_RESULT_ERROR),
- (result.skipped, records.TestResultEnums.TEST_RESULT_SKIP),
- ]
- for bucket_list, expected_enum in buckets:
- for record in bucket_list:
- if record.result != expected_enum:
- raise AssertionError('Expected result %s, got %s.' %
- (expected_enum, record.result))
+ Args:
+ result: The `records.TestResult` object to validate.
+ """
+ buckets = [
+ (result.passed, records.TestResultEnums.TEST_RESULT_PASS),
+ (result.failed, records.TestResultEnums.TEST_RESULT_FAIL),
+ (result.error, records.TestResultEnums.TEST_RESULT_ERROR),
+ (result.skipped, records.TestResultEnums.TEST_RESULT_SKIP),
+ ]
+ for bucket_list, expected_enum in buckets:
+ for record in bucket_list:
+ if record.result != expected_enum:
+ raise AssertionError('Expected result %s, got %s.' %
+ (expected_enum, record.result))