Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13e77e08 authored by Charlie Boutier's avatar Charlie Boutier
Browse files

Avatar: Support atest & multiple mobly class test

* Remove custom avatar_runner
* Add support to handle multiple class tests

Test: atest avatar
Bug: 266125007
Change-Id: Ib3fd77d5587e3a4aad319108aeb08d559e6d1725
parent b2df7207
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -18,8 +18,9 @@ package {

python_test_host {
    name: "avatar",
    main: "example.py",
    main: "main.py",
    srcs: [
        "main.py",
        "example.py",
    ],
    libs: [
+1 −10
Original line number Diff line number Diff line
@@ -331,12 +331,3 @@ class ExampleTest(base_test.BaseTestClass):
            self.dut.host.Disconnect(connection=dut_ref),
            self.ref.host.WaitDisconnection(connection=ref_dut)
        )
 No newline at end of file


if __name__ == '__main__':
    # MoblyBinaryHostTest pass test_runner arguments after a "--"
    # to make it work with rewrite argv to skip the "--"
    index = sys.argv.index('--')
    sys.argv = sys.argv[:1] + sys.argv[index + 1:]
    logging.basicConfig(level=logging.DEBUG)
    test_runner.main()
 No newline at end of file
+20 −0
Original line number Diff line number Diff line
from mobly import suite_runner

import example

import logging
import sys

_TEST_CLASSES_LIST = [example.ExampleTest]


def _valid_argument(arg: str) -> bool:
  return arg.startswith(("--config", "-c", "--tests", "--test_case"))


if __name__ == "__main__":
  logging.basicConfig(level=logging.DEBUG)
  suite_runner.run_suite(
      argv=[arg for arg in sys.argv if _valid_argument(arg)],
      test_classes=_TEST_CLASSES_LIST,
  )