From 6d9fb211b794399ad485037aff2bf2d73099b026 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Wed, 22 Feb 2023 15:32:11 +0100 Subject: [PATCH 1/2] Fix listing on non-fixture dependencies Signed-off-by: Theofilos Manitaras --- reframe/frontend/cli.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 5443675505..3e03a91390 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -69,20 +69,26 @@ def dep_lines(u, *, prefix, depth=0, lines=None, printed=None, adj = u.deps for v in adj: - key = f'{type(v.check).__name__}#{v.check._rfm_fixt_data.scope}' + if v.check.is_fixture(): + fixture_scope = v.check._rfm_fixt_data.scope + key = f'{type(v.check).__name__}#{fixture_scope}' + fixture_vars = fixt_to_vars[key] + else: + fixture_vars = None + unique_checks.add(v.check.unique_name) + if concretized or (not concretized and v.check.unique_name not in printed): dep_lines(v, prefix=prefix + 2*' ', depth=depth+1, lines=lines, printed=printed, - fixt_vars=fixt_to_vars[key]) - - printed.add(v.check.unique_name) - if not v.check.is_fixture(): - unique_checks.add(v.check.unique_name) + fixt_vars=fixture_vars) if depth: - fmt_fixt_vars = " '" - fmt_fixt_vars += " '".join(fixt_vars) + if fixt_vars: + fmt_fixt_vars = " '" + fmt_fixt_vars += " '".join(fixt_vars) + else: + fmt_fixt_vars = '' name_info = f'{u.check.display_name}{fmt_fixt_vars} /{u.check.hashcode}' tc_info = '' From d9787b08b2e2061197db1d7d5cff898a17da8f0a Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 23 Feb 2023 10:00:10 +0100 Subject: [PATCH 2/2] Add unittests Signed-off-by: Theofilos Manitaras --- unittests/test_cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/unittests/test_cli.py b/unittests/test_cli.py index adfe5d0fe3..21705df78c 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -588,6 +588,28 @@ def test_list_tags(run_reframe): assert returncode == 0 +def test_list_tests_with_deps(run_reframe): + returncode, stdout, _ = run_reframe( + system='sys0', + checkpath=['unittests/resources/checks_unlisted/deps_simple.py'], + action='list', + environs=[] + ) + assert 'Found 9 check(s)' in stdout + assert returncode == 0 + + +def test_list_tests_with_fixtures(run_reframe): + returncode, stdout, _ = run_reframe( + system='sys0', + checkpath=['unittests/resources/checks_unlisted/fixtures_simple.py'], + action='list', + environs=[] + ) + assert 'Found 3 check(s)' in stdout + assert returncode == 0 + + def test_filtering_multiple_criteria_name(run_reframe): returncode, stdout, stderr = run_reframe( checkpath=['unittests/resources/checks'],