Skip to content

Commit

Permalink
Merge pull request avocado-framework#5951 from clebergnu/list_resolve…
Browse files Browse the repository at this point in the history
…r_origin

Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja authored Jun 11, 2024
2 parents cea7a22 + 1b99f38 commit 7e2ce97
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
19 changes: 11 additions & 8 deletions avocado/plugins/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _prepare_matrix_for_display(matrix, verbose=False):
type_label = TERM_SUPPORT.healthy_str(kind)
if verbose:
colored_matrix.append(
(type_label, item[1], _get_tags_as_string(item[2] or {}))
(type_label, item[1], item[2], _get_tags_as_string(item[3] or {}))
)
else:
colored_matrix.append((type_label, item[1]))
Expand All @@ -65,6 +65,7 @@ def _display(self, suite, matrix):
header = (
TERM_SUPPORT.header_str("Type"),
TERM_SUPPORT.header_str("Test"),
TERM_SUPPORT.header_str("Resolver"),
TERM_SUPPORT.header_str("Tag(s)"),
)

Expand Down Expand Up @@ -134,13 +135,15 @@ def _get_resolution_matrix(suite):
"""
test_matrix = []
verbose = suite.config.get("core.verbose")
for runnable in suite.tests:

if verbose:
tags = runnable.tags or {}
test_matrix.append((runnable.kind, runnable.uri, tags))
else:
test_matrix.append((runnable.kind, runnable.uri))
for resolution in suite.resolutions:
for runnable in resolution.resolutions:
if verbose:
tags = runnable.tags or {}
test_matrix.append(
(runnable.kind, runnable.uri, resolution.origin, tags)
)
else:
test_matrix.append((runnable.kind, runnable.uri))
return test_matrix

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion selftests/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"nrunner-requirement": 28,
"unit": 669,
"jobs": 11,
"functional-parallel": 306,
"functional-parallel": 307,
"functional-serial": 7,
"optional-plugins": 0,
"optional-plugins-golang": 2,
Expand Down
16 changes: 16 additions & 0 deletions selftests/functional/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ def test_runnable_recipe(self):
result.stdout,
)

def test_runnable_recipe_origin(self):
test_path = os.path.join(
BASEDIR,
"examples",
"nrunner",
"recipes",
"runnable",
"python_unittest.json",
)
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",
result.stdout,
)


class ResolverFunctionalTmp(TestCaseTmpDir):
def test_runnables_recipe(self):
Expand Down

0 comments on commit 7e2ce97

Please sign in to comment.