[autotest] Provide suggestions when test_that failed to locate any test.
Make it easier for user to locate the exact test to run. When test_that failed
to locate any test matching the test argument, provide a list of suggestions.
For example:
test_that -b peppy --fast 172.27.213.193 e:dummy_Pass_123
leads to following exception message:
ValueError: Found no tests. Check your suite name, test name, or test matching wildcard.
Did you mean any of following tests?
dummy_Pass
dummy_PassServer
dummy_Pass.wifichaos
dummy_Pass.actionable
dummy_Pass.experimental
dummy_Fail
dummy_Pass.bluetooth
dummy_RepeatArgs
dummy_FailServer
dummy_FailServer_Flaky
BUG=chromium:441455
TEST=local test runs with test_that:
test_that -b peppy --fast 172.27.213.193 e:dummy_Pass_123
test_that -b peppy --fast 172.27.213.193 f:dummy
test_that -b peppy --fast 172.27.213.193 suite:bvt_123
Change-Id: I22a8b566580e492c68b8729afc22d6950a2166a3
Reviewed-on: https://chromium-review.googlesource.com/237300
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/site_utils/test_that_unittest.py b/site_utils/test_that_unittest.py
index f771c6c..f0fd0f3 100755
--- a/site_utils/test_that_unittest.py
+++ b/site_utils/test_that_unittest.py
@@ -172,6 +172,7 @@
afe = test_that.setup_local_afe()
autotest_path = 'ottotest_path'
suite_name = 'sweet_name'
+ test_arg = 'suite:' + suite_name
remote = 'remoat'
build = 'bild'
board = 'bored'
@@ -199,7 +200,7 @@
self.mox.StubOutWithMock(test_that, 'fetch_local_suite')
test_that.fetch_local_suite(autotest_path, mox.IgnoreArg(),
- afe, remote=remote, build=build,
+ afe, test_arg=test_arg, remote=remote, build=build,
board=board, results_directory=results_dir,
no_experimental=False,
ignore_deps=ignore_deps