Fail when no test case selected

When the list based filtering logic was used
and no test was selected at the end.
testr was invoked to run all test.

For example:
ostestr --regex a --black-regex a

Change-Id: I7b580c3954f71dc5fe347b82d6d14004bfdb8f22
This commit is contained in:
Attila Fazekas 2017-05-20 20:21:08 +02:00
parent e84d06292b
commit c282cbfc46
2 changed files with 7 additions and 0 deletions

View File

@ -256,6 +256,10 @@ def _call_testr_with_list(opts, test_list, others):
print("\n".join(test_list))
return 0
if not test_list:
print("No testcase selected to run")
return 8
ec = call_testr(None, opts.subunit, opts.pretty, opts.list,
opts.slowest, opts.parallel, opts.concurrency,
opts.until_failure, opts.color, test_list, others)

View File

@ -102,3 +102,6 @@ class TestReturnCodes(base.TestCase):
def test_list(self):
self.assertRunExit('ostestr --list', 0)
def test_no_test(self):
self.assertRunExit('ostestr --regex a --black-regex a', 8)