Skip to content

Commit

Permalink
Improve message when resolvers don't resolve the reference
Browse files Browse the repository at this point in the history
This will improve avocado error message when some reference wasn't
resolved. It adds a pointer to `avocado -V list` which provides more
information about references.

Reference: avocado-framework#5644
Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed May 30, 2023
1 parent 9dd31c1 commit 1d2aae8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion avocado/core/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ def resolve(references, hint=None, ignore_missing=True, config=None):
# resolution process
missing = [_ for _ in missing if not os.path.isdir(_)]
if missing:
msg = f"Could not resolve references: {','.join(missing)}"
msg = (
f"No tests found for given test references: {', '.join(missing)}\n"
f"Try 'avocado -V list {' '.join(missing)}' for details"
)
raise JobTestSuiteReferenceResolutionError(msg)

return resolutions
6 changes: 5 additions & 1 deletion selftests/functional/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,11 @@ def test_not_found(self):
result = process.run(cmd_line, ignore_status=True)
self.assertEqual(result.exit_status, exit_codes.AVOCADO_JOB_FAIL)
self.assertEqual(result.stdout, b"")
self.assertEqual(result.stderr, b"Could not resolve references: sbrubles\n")
self.assertEqual(
result.stderr,
b"No tests found for given test references: sbrubles\n"
b"Try 'avocado -V list sbrubles' for details\n",
)

def test_invalid_unique_id(self):
cmd_line = (
Expand Down

0 comments on commit 1d2aae8

Please sign in to comment.