Skip to content

Conversation

@jdstanko
Copy link
Contributor

@jdstanko jdstanko commented Jan 29, 2025

This adds filtering tests with suffixes when using run_suite_class. The behavior when using run_suite, is not modified as that function does not currently support using name_suffix when running tests.

The expected form of the --tests CLI arg is <test_class_name>[_<test_suffix>][.<test_name>] e.g. Foo_A.bar would run the A configuration of test bar on test class Foo


This change is Reviewable

Copy link
Collaborator

@xianyuanjia xianyuanjia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @jdstanko and @mhaoli)


mobly/suite_runner.py line 119 at r1 (raw file):

      metavar='[ClassA[.test_a] ClassB[.test_b] ...]',
      help='A list of test classes and optional tests to execute.',
  )

Should also update the CLI usage here

Also point out limitations of using suffix

Code quote:

  parser.add_argument(
      '--tests',
      '--test_case',
      nargs='+',
      type=str,
      metavar='[ClassA[.test_a] ClassB[.test_b] ...]',
      help='A list of test classes and optional tests to execute.',
  )

mobly/suite_runner.py line 399 at r1 (raw file):

  # The user is selecting some tests to run. Parse the selectors.
  # Dict from test_name class name to list of tests to execute (or None for all
  # tests).

technically the output here would be dict from tuple to list of tests. Either update or drop the comment

Code quote:

  # Dict from test_name class name to list of tests to execute (or None for all
  # tests).

mobly/suite_runner.py line 421 at r1 (raw file):

  This function transforms a list of selector strings (such as FooTest or
  FooTest.test_method_a) to a dict where keys are test_name classes, and

The "keys" here in the docstring should also be updated

This adds support for using test name suffixes when using
`run_suite_class` with the `--tests` arg. It does not change
the behavior of `run_suite`, however, since that method does
not support using `name_suffix`.
Copy link
Contributor Author

@jdstanko jdstanko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @mhaoli and @xianyuanjia)


mobly/suite_runner.py line 119 at r1 (raw file):

Previously, xianyuanjia wrote…

Should also update the CLI usage here

Also point out limitations of using suffix

Done.


mobly/suite_runner.py line 399 at r1 (raw file):

Previously, xianyuanjia wrote…

technically the output here would be dict from tuple to list of tests. Either update or drop the comment

Done.


mobly/suite_runner.py line 421 at r1 (raw file):

Previously, xianyuanjia wrote…

The "keys" here in the docstring should also be updated

Done.

Copy link
Collaborator

@xianyuanjia xianyuanjia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on @mhaoli)

@xianyuanjia xianyuanjia merged commit ac65869 into google:master Jan 30, 2025
7 of 8 checks passed
@mhaoli mhaoli added this to the Mobly Release 1.13 milestone Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants