Skip to content

Commit

Permalink
Indetifier usage in list
Browse files Browse the repository at this point in the history
After this commit the `avocado list` command will print runnable
identifier instead of url and `avocado -V list` will add the identifier
as another column in the list matrix. It will be helpful when users will
define their own identifiers after change in e7228af.

Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed Aug 5, 2024
1 parent e7228af commit 8d414e3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions avocado/plugins/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ def _prepare_matrix_for_display(matrix, verbose=False):
type_label = TERM_SUPPORT.healthy_str(kind)
if verbose:
colored_matrix.append(
(type_label, item[1], item[2], _get_tags_as_string(item[3] or {}))
(
type_label,
item[1],
item[2],
item[3],
_get_tags_as_string(item[4] or {}),
)
)
else:
colored_matrix.append((type_label, item[1]))
Expand All @@ -65,6 +71,7 @@ def _display(self, suite, matrix):
header = (
TERM_SUPPORT.header_str("Type"),
TERM_SUPPORT.header_str("Test"),
TERM_SUPPORT.header_str("Uri"),
TERM_SUPPORT.header_str("Resolver"),
TERM_SUPPORT.header_str("Tag(s)"),
)
Expand Down Expand Up @@ -140,10 +147,16 @@ def _get_resolution_matrix(suite):
if verbose:
tags = runnable.tags or {}
test_matrix.append(
(runnable.kind, runnable.uri, resolution.origin, tags)
(
runnable.kind,
runnable.identifier,
runnable.uri,
resolution.origin,
tags,
)
)
else:
test_matrix.append((runnable.kind, runnable.uri))
test_matrix.append((runnable.kind, runnable.identifier))
return test_matrix

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion selftests/functional/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_runnable_recipe_origin(self):
cmd_line = f"{AVOCADO} -V list {test_path}"
result = process.run(cmd_line)
self.assertIn(
b"python-unittest selftests/unit/test.py:TestClassTestUnit.test_long_name runnable-recipe\n",
b"python-unittest selftests/unit/test.py:TestClassTestUnit.test_long_name selftests/unit/test.py:TestClassTestUnit.test_long_name runnable-recipe\n",
result.stdout,
)

Expand Down

0 comments on commit 8d414e3

Please sign in to comment.