diff --git a/os_testr/ostestr.py b/os_testr/ostestr.py index 990f088..1c41079 100755 --- a/os_testr/ostestr.py +++ b/os_testr/ostestr.py @@ -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) diff --git a/os_testr/tests/test_return_codes.py b/os_testr/tests/test_return_codes.py index 082a74a..4c336b1 100644 --- a/os_testr/tests/test_return_codes.py +++ b/os_testr/tests/test_return_codes.py @@ -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)