Skip to content

Commit 49a8cfe

Browse files
Merge pull request #1075 from linsword13/info-var
Update info cmd to accommodate recent variable change
2 parents 9a1d07e + e7c765c commit 49a8cfe

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

lib/ramble/ramble/cmd/common/info.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"target_shells": "shell_support_pattern",
3737
"templates": None,
3838
"validators": None,
39+
"object_variables": None,
3940
# Application specific:
4041
"workloads": None,
4142
"workload_groups": None,
@@ -50,12 +51,7 @@
5051
"executable_modifiers": None,
5152
"env_var_modifications": None,
5253
"required_vars": None,
53-
"modifier_variables": None,
5454
"package_manager_requirements": None,
55-
# Package manager specific:
56-
"package_manager_variables": None,
57-
# Workflow manager specific:
58-
"workflow_manager_variables": "wm_vars",
5955
}
6056

6157

@@ -181,7 +177,7 @@ def _unpack_when_set_if_needed(internal_attr: dict):
181177

182178

183179
def _print_nonverbose_list_attr(internal_attr, pattern="*", format=supported_formats.text):
184-
to_print = fnmatch.filter(internal_attr, pattern)
180+
to_print = fnmatch.filter(map(str, internal_attr), pattern)
185181
if format == supported_formats.lists:
186182
color.cprint(" " + str(list(to_print)))
187183
elif format == supported_formats.text:
@@ -324,7 +320,7 @@ def print_single_attribute(obj, attr, verbose=False, pattern="*", format=support
324320
_print_verbose_dict_attr(internal_attr, pattern=pattern, indentation=indentation)
325321
# If the attribute is not a dict, print using the existing format rules.
326322
elif isinstance(internal_attr, list):
327-
to_print = fnmatch.filter(internal_attr, pattern)
323+
to_print = fnmatch.filter(map(str, internal_attr), pattern)
328324
if format == supported_formats.lists:
329325
color.cprint(" " + str(list(to_print)))
330326
elif format == supported_formats.text:

lib/ramble/ramble/test/cmd/info.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,22 @@ def test_mock_spack_info_software(mock_applications, app_query):
9999

100100
for field in expected_fields:
101101
assert field in out
102+
103+
104+
@pytest.mark.parametrize(
105+
"info_query",
106+
[
107+
["--type", "modifiers", "apptainer"],
108+
["--type", "modifiers", "apptainer", "-vv"],
109+
["--type", "package_managers", "spack"],
110+
["--type", "workflow_managers", "slurm"],
111+
],
112+
)
113+
def test_non_app_object_info_common_fields(info_query):
114+
expected_fields = (
115+
"Description",
116+
"object_variables",
117+
)
118+
out = info(*info_query)
119+
for field in expected_fields:
120+
assert field in out

0 commit comments

Comments
 (0)